Iirc the NS collections were there due to simplifying porting of apps from objc to Java. I don’t think there is any big difference in performance Sent from my iPhone On 2 Feb 2025, at 12:18, Jérémy DE ROYER via Webobjects-dev <webobjects-dev@lists.apple.com> wrote:
Hi all,
Even if I still use EOF (due to inheritance limitations of Cayenne), I followed Hugi’s precepts :
- « use 100% java native whenever possible »
One other advantage when working in a team… is that 100% java is widely documented and exampled... and it's more attractive to newbees.
Sorry if I don’t « really » answer the question 😄
Jérémy
Le 2 févr. 2025 à 11:13, Hugi Thordarson via Webobjects-dev <webobjects-dev@lists.apple.com> a écrit :
When
I made the switch to Java collections I did do some benchmarking. Haven’t got the code anymore (this was a decade ago) but at that time, the Java collection classes were faster, but the operations were really so fast in both cases that the differences were
negligible — at that time.
Since
then, a decade of improvements has happened in the Java collections so I think we can guess where you’ll find performance improvements — and will keep getting performance improvements. On one hand you have old classes written in an old version of Java, on
the other hand you have actively maintained open source classes used by millions of programmers and maintained by the performance-obsessed authors of Java and the JDK itself.
And
now for the opinion piece:
Unless
you’re writing extremely performance-sensitive code — even if the foundation collections were faster I think it makes sense to use Java collections and write to the standard Java collection APIs where you don’t *need* foundation collections, because If you’re
using foundation specific APIs, your code is really already obsolete at the time of writing. I never regretted the switch and have hardly seen an NS* collection class in my code in years, except where explicitly required as a parameter for passing into WO
APIs. (that story may be a little different if you’re using EOF which uses the NS collections everywhere, so this may not apply in that case).
The
Java collection classes do have their warts, the most obvious one to us coming from the NS* world being the non-API-differentiation between mutable and immutable collections (weird design oversight) but that hasn't plagued me, really. It’s just something you’re
aware of and don’t really hit often.
Another
one for us WO users is that you can’t use KVC operators on Java collections (someArray.@sortAsc, .@sum etc). When I made the switch I always thought I’d miss these hugely and planned to write operator support into ERXComponent’s valueForKeyPath(), but never
got around to it since I really didn’t miss the operators, preferring to keep my logic in Java rather than templates (compile time errors and refactoring support are awesome things).
Probably
just saying things you know — but I thought it might have some value hearing from someone that moved to Java collections and doesn’t regret it.
Cheers,
-
hugi
On 2 Feb 2025, at 00:29, ocs--- via Webobjects-dev <webobjects-dev@lists.apple.com> wrote:
Hi there,
did ever anybody tried some benchmarks to find whether it is better to use WO collections (NSArray, NSDictionary...) as widely as possible (ie essentially anywhere, unless one really needs to store nulls or can't do without ConcurrentHashMap or so), or whether
it's better to use standard collections (List, HashMap...) wherever they happen to work properly (which is surprisingly often, but not anywhere)?
Are they roughly comparable, or are one or the others considerably better?
Thanks!
OC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/hugi%40karlmenn.is
This email sent to h...@karlmenn.is
_______________________________________________
Do
not post admin requests to the list. They will be ignored.
Webobjects-dev
mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update
your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/jeremy.deroyer%40ingencys.net
This
email sent to jeremy.dero...@ingencys.net
_______________________________________________Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription:https://lists.apple.com/mailman/options/webobjects-dev/amedeomantica%40me.comThis email sent to amedeomant...@me.com
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com