• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Single table / Simple Locking - WeakHashMap vs WeakReferences

 
town drunk
( and author)
Posts: 4118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
/*

Originally posted by Jim Yingst:
[QB]And now more recently-written stuff. (Had to split posts; I ran out of smilies.)
[Max]: I find it ironic, given the Goode vs. Eveile thread, that you're supporting arguments that are 'generally true'. Irony makes me laugh, laughter puts me in a good mood, and a good mood makes me tease people.
Ah, I see. From my perspective the difference is:


I think you've just got author envy


How about basing it on the premise that it's pretty darn unlikely, and even if it does, it's not as though our architecture has become crippled, it's just not quite as fast as an alternative design which we had discarded based on a premise that turned out not to be true?


Naw, it's still Just Wrong(tm)


[Jim]: Have you given up you wayward ways then, and joined the Forces Of Light?
Couldn't tell what this was in reference to. Though for a good answer is "probably not".


Aren't you part of the Forces Of Darkness on the MD True Believer survey?



[Max]: How about "In general, I believe that Hashmap.get() is faster then hashmap.containsValue(). I can't prove this, and would never assert it as anything more then my belief..".
Eh, too wimpy. How about "All commonly-available versions of java.lang.HashMap implement containsValue()
OK, that was longer than originally intended. Maybe just the first sentence or two is sufficient for most cases. But you get the idea.


Looked through all of them, have you


[Max]: Jim's a terrific and experienced developer, and one of the fairest people I've ever met.
Aww, now how am I supposed to stay irritated with Max after that?



Are you really irritated? I'd be disapointed.
M
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not a good idea, IMO, to design for a particular implantation of the JDK.
Agreed. I think of my approach as simultaneously designing to avoid the worst-case allowable behavior on any JDK, while also achieving the best typical behavior on commonly available JDKs (with no known exceptions currently). This should be avoided? It seems like you're the one pinning your arguments on a particular JDK that doesn't even exist, and if it did, its merits would still be undocumented in the API for HashMap. You prefer to design for undocumented (and currently nonexistant) behavior?
I actually read the above @ Sun, almost verbatim.
Really? Hmmm, maybe I should apply for a job there.
Regardless of the merits of point, your example is in the wrong category here. That is, there is no actual benefit to just slowing FileChannels down. There is, however, a reasonable benefit to a different HashMap implementation in order to offset it's memory usage.
Dunno Max, that sounds dangerously close to applying some of that icky common sense to make an assertion that you don't really know and can't prove.
More seriously, I agree that this sort of FileChannel hacking is even less justified than what you suggest for HashMap. But I still think you're seriously overestimating the likelihood of Sun ever modifying the main java.lang.HashMap class the way you suggest. If they want to do it, they'll make a new class that also implements Map, but has an API which very clearly states how it's different from a conventional HashMap. Well, unless they accidentally leave off useful info from the API, as sometimes happens.
I think you've just got author envy

Naw, it's still Just Wrong(tm)

OK, if you don't want to join the MD thread, maybe we can get Joe Pluta to come here.
Aren't you part of the Forces Of Darkness on the MD True Believer survey?
Yep. (Hah, you do read MD!) But what I meant was that I wasn't sure how this connected to our conversation.
Looked through all of them, have you
Nope, just a few. Find anything to contradict me, or does your research support my assertions?
Are you really irritated? I'd be disapointed.
Well I get irritated at little things all the time; passes quickly and means nothing. This is in that same category. But for most of it, I'm having fun while concocting my responses. You too, I hope. Cheers...
 
Max Habibi
town drunk
( and author)
Posts: 4118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jim Yingst:
It's not a good idea, IMO, to design for a particular implantation of the JDK.
Agreed. I think of my approach as simultaneously designing to avoid the worst-case allowable behavior on any JDK, while also achieving the best typical behavior on commonly available JDKs (with no known exceptions currently). This should be avoided?


Sounds reasonable. OTOH, I don't see this as a compeling reason in of itself for the SCJD assignment. Couple that with the obvious(IMO) benefits of using a WeakHashMap(if you're willing to use a Data-record map), and I think the issue is clear. Again, JMO.


It seems like you're the one pinning your arguments on a particular JDK that doesn't even exist, and if it did, its merits would still be undocumented in the API for HashMap. You prefer to design for undocumented (and currently nonexistant) behavior?


No, nor do I prefer to club baby seals . My point is that there is no compelling reason to think that, just because a given implementation is faster at activity X, that other implementations are similarly faster. As a matter of fact, I know that this is not the case.


I actually read the above @ Sun, almost verbatim.
Really? Hmmm, maybe I should apply for a job there.
Regardless of the merits of point, your example is in the wrong category here. That is, there is no actual benefit to just slowing FileChannels down. There is, however, a reasonable benefit to a different HashMap implementation in order to offset it's memory usage.
Dunno Max, that sounds dangerously close to applying some of that icky common sense to make an assertion that you don't really know and can't prove.


Common sense isn't icky Jim: it just needs to be balanced with specialized sense


More seriously, I agree that this sort of FileChannel hacking is even less justified than what you suggest for HashMap.


As you describe it, it's not justified at all.


But I still think you're seriously overestimating the likelihood of Sun ever modifying the main java.lang.HashMap class the way you suggest. If they want to do it, they'll make a new class that also implements Map, but has an API which very clearly states how it's different from a conventional HashMap. Well, unless they accidentally leave off useful info from the API, as sometimes happens.


Agreed. I would content that this other class would also be a hashmap.


Yep. (Hah, you do read MD!) But what I meant was that I wasn't sure how this connected to our conversation.


You were invoking God. Sure I read MD: I love a good argument. But I'm still not getting in there


Looked through all of them, have you
Nope, just a few. Find anything to contradict me, or does your research support my assertions?


Just questioning the premise for you research. When you had made that statement, how many 1.4+ JDKs had you actually examined? I'm willing to take you @ your word


Are you really irritated? I'd be disappointed.
Well I get irritated at little things all the time; passes quickly and means nothing. This is in that same category. But for most of it, I'm having fun while concocting my responses. You too, I hope. Cheers...


Well, my hobby is bare knuckle boxing(mouthpiece, cup, all targets open, all techniques legal). Tends to put 'irritated' into perspective
M
[ September 17, 2003: Message edited by: Max Habibi ]
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, my hobby is bare knuckle boxing(mouthpiece, cup, all targets open, all techniques legal).
If you were to choose between being a sadist or a masochist, what would you be, Max?
 
Max Habibi
town drunk
( and author)
Posts: 4118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eugene Kononov:
Well, my hobby is bare knuckle boxing(mouthpiece, cup, all targets open, all techniques legal).
If you were to choose between being a sadist or a masochist, what would you be, Max?


a pacifist, of course
M
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Max: a pacifist, of course
Good. We need you badly in the popular MD thread as a pacifier, -- some people use bare knuckles there, and no one has either a mouthpiece or a cup.
 
Max Habibi
town drunk
( and author)
Posts: 4118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eugene Kononov:
Max: a pacifist, of course
Good. We need you badly in the popular MD thread as a pacifier, -- some people use bare knuckles there, and no one has either a mouthpiece or a cup.


Let me quote myself regarding MD.
heh. You couldn't get me near that crap for all the beer in England.

M
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
heh. You couldn't get me near that crap for all the beer in England.
Just one more question, Max (I know, this discussion doesn't even remotely belong here, but after all you made the first reference to the outside subject). I thought martial arts was as much about the power of body as it is about the power of mind. Do you subscribe to that principle?
 
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Talking of English beer I think I'm off to watch the might Arsenal in the pub, might even manage to wind up a few scousers. Too much java is not a good thing.
Tony
 
Max Habibi
town drunk
( and author)
Posts: 4118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eugene Kononov:
heh. You couldn't get me near that crap for all the beer in England.
Just one more question, Max (I know, this discussion doesn't even remotely belong here, but after all you made the first reference to the outside subject). I thought martial arts was as much about the power of body as it is about the power of mind. Do you subscribe to that principle?


I've actually given this a lot of though. I'll quote two posts on the topic.

My ethic isn't combat-is-everything. what I _am_
advocating, however, is honesty, simplicity, and straightforwardness in all
areas of life. To me, seeing 'spiritual' MAs is like seeing those poofy, goofy
poodle dogs: that's not in the nature of the beast. A dog was never supposed to
be that way. The animal hates it, I hate it, and the 'owner', if he's perceptive
enough to see what's going on, would hate it too. MA were designed to be a tool
for fighting. That's gift enough: That's how I practice them. Cars were designed
to be a tool for transportation: that's how I use them. Forks were...well, you
get the idea. It's not that I think fighting is better then, say, cooking. It's
just that I think fighting is what you should be learning and practicing @ an MA
school, and cooking is what you should be practicing in the kitchen

and

I practice martial arts because I enjoy doing do. To me, the 'martial' is about fighting, the art
is about the harmonic cord that fighting(when done well) resonates in all of us. I feel it when I see
an opponent make a good move, a tiger bring down his prey, a fighter jet maneuver beautifully, a good
queen sack in chess, etc. Those all touch the same place in me, regardless of their moral
trappings("but he killed Bambi!"). _that_ is the art(IMO). The hand waving, the katas, the belts, the
uniforms, etc: that's for the tourists.

Of course, I'm much calmer now
M
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Max: Of course, I'm much calmer now
I think I've accomplished my mission here.
 
Let nothing stop you! Not even this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic