-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reduce use of external tools in script code #358
Comments
@markusschuh thanks for this feedback. I also agree that the current way we are reading properties ( What is important to me however, is to have the pre-requisites as minimal as possible. Could we even do a trade-off and detect if bashv4 is available and then user performance-optimized code but still keep support for bashv3 (and optionally print out a log message that upgrade to bashv4 is recommended and will boost performance)? |
Actually looking at |
Execution speed is only one aspect, why use of external tools should be kept as small as possible. There is also a small risk of different syntax between the BSD-originating tools on macOS vs. the GNU based on other supported environments. Granted - by restricting to the base options the usage is compatible most often. And with respect to bashv3, there is the additional issue, that use of Wrt to speed: The boost in this example is 23 seconds for 100 (!) iterations - so of course this is neglectable for a single run - nevertheless worth to mention it. At least, it has made you mention, that read of properties files is done on each devon run. So let's as least speed up this a bit ( 200 ms less ) by changing
with
But while I am testing this code replacement, I realise some other small issue with the current code: When any of the read properties files has Windows line endings, empty lines are not considered empty and the code triggers an
which yields
I'll work on a PR for this. |
@markusschuh I meanwhile implemented PR #383 |
As an developer with experience in shell scripting, I want to share my knowledge of advanced scripting techniques, so that this project may win from that.
I propose to introduce more modern shell scripting techniques into the devonfw-ide code - even if that comes with some disadvantages:
Pro: More execution speed, less external dependencies,
Con: Bash v3 no longer sufficient, more script skills needed for developers, code maybe harder to read
I am aware, that the balance between Pro/Con isn't a clear win to make such a change, Even when the below implementation speeds up the import of specific keys from a java properties file at about 200 times, this typically is not that relevant for the user, since even the slower implementation ( about 200 ms) is quick enough for the user.
In detail the default bash in macOS is an issue, since Apple sticks to bashv3 to avoid the bashv4 license. On the other side it is easy to install a bashv4 on macOS.
Nevertheless - even when this enhancement won't be accepted - I want at least increase the awareness for those different solution algorithms. If not here it may be helpful elsewhere.
content of the used sample
project.properties
The text was updated successfully, but these errors were encountered: