-
Notifications
You must be signed in to change notification settings - Fork 40
Use ifNil:
in isShorter:than:
.
#99
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
Conversation
Instead of `isNil ifTrue:`.
Looking at the other languages, I think the change should be fine. Happy to merge it, but would prefer to keep the SOM and SOMns benchmarks in sync with the Smalltalk ones. And yeah, the splitting issue, you probably still want to fix :) |
Oh right, the SOM impl is separate. For some reason, I thought it’s derived from the Smalltalk code. I pushed another commit. |
Signed-off-by: Stefan Marr <[email protected]>
FWIW I recall that we did similar for Ruby but everywhere: 8ccc0c9 (for idiomatic code reasons mostly, |
There are a few more |
Note that some of these are newspeak, but the reasoning shouldn't be different. |
The reason of |
After looking at other usages, I'm not so sure anymore how far we want to go here. There are, for example, Any thoughts? |
Yeah, I pushed the SOMns commit, mostly to indicate that it's also separate code. That some variations are currently missing from SOM seems only a small hurdle. Though, it's a bit of extra work. @OctaveLarose, for SOM-RS, did you implement special handling for |
som-rs doesn't have It sounds like a good change, though! I'd not realized it was a common case. |
Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
The update for SOM is here: SOM-st/SOM#123 |
The dev branch is really the main branch. The release branch is very old… Also switch to Ubuntu 24.04 and set JAVA_HOME. Signed-off-by: Stefan Marr <[email protected]>
Performance difference on the SOM implementations without specific support for It looks a bit noisy, and there might be some extra overhead compared to the inlined With inlining of |
I'd argue this is slightly more idiomatic and it seems that this is also supported in SOM. In fact, the Squeak/Smalltalk compiler turns
ifNil:
into an identity check (== nil
) plus jump rather than sendingisNil
to the receiver and then jump.I noticed this some time ago when I looked into excessive splitting in TruffleSqueak (here's
a recent example). It turned out that the additional
isNil
send causes these splits.Surely, there are ways to fix the splitting issue in TruffleSqueak. I just thought I open this anyway because, again, it is more idiomatic and because of that, also specifically optimized by the Squeak/Smalltalk compiler.