Background (can be skipped)
While trying to optimize performance critical parts of a project we’re working on, I sometimes stumble into what turns out to be opportunities for improvement in the Swift compiler and/or the Standard Library (even though I’m sure my choice/design of algorithms and data structures could also be improved).
Isolating every potential issue and formulating a good Jira bug/improvement can be very time comsuming for non-native-english-speaking non-compiler-hackers like myself.
I’d find it much easier to create a forum post containing a minified toy-version of my original problem, eg a sufficiently commented self-contained little command line program with detailed compile instructions, etc.
Other forum members might then find it interesting to help identifying and formulating any potential compiler/stdlib bug/improvement, or they might point out that I’m simply misunderstanding something and the problem is only on my side, which means I (and perhaps others) have learned something new.
Proposal / Question
While trying to optimize Swift code as a single individual or a small team might easily lead to frustration and disappointment in the current state of Swift, maybe resulting in a decision to go back to C/C++ for performance critical code, I think that doing it in a community could instead lead to more people contributing to Swift in various important ways, for example:
Identifying (and ideally reporting) compiler/optimizer/stdlib bugs or improvements.
Providing ideas for (and ideally submitting) new performance tests for the compiler.
Spreading knowledge and best practices in the context of performance critical code, including information about what is and isn’t “Swift’s fault”.
Does anyone else see value in a group activity like this?
In what form?
My Thoughts on This
I’d say it’s not always easy to choose an existing category for this kind of posts, eg: Should I pick “Using Swift” or maybe “Development - Standard Library” since I suspect my code example might lead to the identification of an opportunity for improvement in the stdlib implementation, or maybe “Development - Compiler” since it might end up indicating an optimizer bug?
And I guess the effectiveness of this sort of group-activity depends heavily on the way it is organized.
For example, maybe there could be signal/noise enhancing rules like:
- Each original post must contain a working single-file command line program.
- The purpose and content of the program should be quickly understood, and it should be clear in what way the OP thinks it could be optimized.
- The OP should provide an example of compiling and running the program from the command line, showing the version of the compiler and the flags used.
Other forum participants can then always expect to be able to just read, copy, paste and compile it. Best practices for measuring execution times etc could evolve or be decided, etc.
If enough interest is expressed, perhaps it could motivate a new category?
I feel that just a tag (and perhaps a set of rules that could be linked to somehow) would force us to choose one of the other categories and thereby polluting them with this kind of posts.
But maybe forums.swift.org is not the right place, or maybe there are reasons why the whole thing is not a good idea at all?