Skip to content
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

Use string interpolation instead of string concatenation #174

Closed
wants to merge 1 commit into from

Conversation

thekid
Copy link
Member

@thekid thekid commented Aug 20, 2023

This should theoretically improve speed - however, the effect is not measurable in the XP Compiler:

Best run before

$ xp test src/test/php
# ...
Test cases:  956 succeeded, 3 skipped
Memory used: 11623.54 kB (11677.67 kB peak)
Time taken:  0.232 seconds (0.508 seconds overall)

Best run after

$ xp test src/test/php
# ...
Test cases:  956 succeeded, 3 skipped
Memory used: 11630.20 kB (11684.33 kB peak)
Time taken:  0.234 seconds (0.499 seconds overall)

@@ -113,7 +113,7 @@ protected function emit() {
* @return void
*/
protected function emitOperator($result, $operator) {
throw new IllegalStateException('Unexpected operator '.$operator->value.' at line '.$operator->line);
throw new IllegalStateException("Unexpected operator {$operator->value} at line {$operator->line}");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latter is definitely more readable, we might want to keep this even if we decide not to merge this entire pull request.

@thekid thekid closed this Oct 1, 2023
@thekid thekid deleted the refactor/interpolation branch October 1, 2023 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

1 participant