Which one of these three loops is the most efficient? How can I prove the answer?
I’ve listed the source code below. The three loops are:
Foreach over an int array
Simple for over an int array
For over an int array, hoisting out the length value
The third option is to be avoided. The JIT looks for the pattern in version #2, and knows how to optimize it. If you pull the value out into a temporary, it may not optimize it. Of course, you know that because you’ve been measuring your important scenarios…
Comments Off on Efficiency of iteration over arrays?
Some guy managed to build a DIY “steady-cam” for $14 (those things which help keep TV crews keep their videocameras from shaking while they’re running around shooting reality shows), which might not sound like a big deal until you realize that a professional Steadicam (that’s the brand name) costs around $1,500. [Via MetaFilter] via [Engadget]
I swear I’m going to do this as soon as my ear infection clears up.
Comments Off on $14 DIY steady-cam
Jetway sells a new small form factor PC called the 860Twin that can be used by two people at the same time. via [Engadget]
Useful for pair programming?
Comments Off on Jetway’s dual-user PC
Quick links for a dictionary of algorithms and data structures and a book on exact string matching algorithms. (via HotLinks) More bedtime reading Update: The memory management reference, via Simon’s linklog…. via [Curiosity is bliss]
Comments Off on Structures and algorithms references
Comments Off on Why Whitehorse doesn’t use UML
“These annotations are then used for performing context checks or are passed on to subsequent modules, for example to aid in code generation.” — Modern Compiler Design, Grune et al.
The meme says:
Grab the nearest book.
Open the book to page 23.
Find the fifth sentence.
Post the text of the sentence in your journal along with these instructions
(watch how it is spreading on the blogsphere here or here)
via John Shute’s Weblog
P.S. I’m not proud to be reading a book on writing compilers on a Sunday.
Comments Off on Page 23
Chris Pratley asked for feedback on how blogging from OneNote should appear and my comments became too unwieldy for his comments box:
To dispense with two crucial things: ink support and layout support (i.e., not just tables but the arbitrary positioning of elements in X-Y space a la “real” OneNote). AFAIK, there is no blogging tool right now that allows you to draw a map and type “Bob’s House” at the appropriate spot; for all the power of Blogging As It Exists, it basically works with text streams.
Now for the more ruminative stuff: OneNote has the metaphor of pages, tabs, and notebooks. The obvious mapping is to blog entries, categories, and blogs. So I would expect that to “subscribe to a blog” in OneNote, I would get a new notebook that periodically updated itself; new titled pages appearing for every new post. Since page titles have limited screen real-estate, this introduces a navigation problem: perhaps one needs some kind of automatic Table of Contents page, essentially providing aggregator services. Or… maybe one doesn’t subscribe to a blog in OneNote, perhaps aggregation is the role of NewsGator / Outlook and a OneNote “subscribed to” blog represents posts that one wishes to keep around for reference: one still would have a OneNote notebook corresponding to the blog, but the notebook wouldn’t update itself, one would use a SideNote / Snippet sort of capability to shoot entries from the aggregator into the notebook.
So upstream you must support ink and layout, downstream you must support the blog -> category -> entry hierarchy. The third leg of the stool is clearly linking. The feedlink / permalink distinction is the clearest example I know of REST: the feedlink is a permanent resource of “the latest stuff” the permalink is a permanent resource to “this particular thing.” I want hyperlinks in OneNote that embrace this distinction and I want those hyperlinks to be able to navigate not only across the World Wide Web (of course) but within my own computer, workgroup, corporation, and social networks. In other words, I want OneNote notebooks to become transparent to deep linking: onenote://machinename/mynotebook/mypage#myanchor as a URI (short of onenote as a complete scheme, I’ll settle for a transition period where http is shoehorned into service). Creating good RESTian links must be reduced to a trivial service (with my Tablet I want to be able to circle some elements, make a gesture, and those elements become a post, with a permalink and a reference in the feedlink).
I also want to make a slightly different gesture to free the elements for editing. In other words, the “square” gesture makes a post that only I can edit (a traditional blog entry), the “star” gesture makes a post that anyone can edit (a wiki-like entry), the “circle” gesture makes a post that only people in the “ninja” group can edit, etc.
Comments Off on OneNote and Blogging
In a comment on Scoble’s “persuasion” post, there’s a link to this entry by Dave Winer in which he dreams of saving Apple by dint of a $1 billion checkbook and slavish devotion to software developers. sed/Apple/Sun/ and it’s a timely read.
Comments Off on Dave Winer saves Apple^h^h^h^h^hSun
Scoble asks “How do you persuade?” in which he poo-poos consistent positive statements and talks up authority. It turns out there are scientific studies. According to Robert B. Cialdini’s February 2001 Scientific American article “The Science of Persuasion” (my research library can beat up your research library!) the 6 keys to reciprocity are: reciprocation, consistency (get people to say “yes”), social validation (many people doing it), liking, authority, and scarcity. Cialdini has a book: “Influence: The Psychology of Persuasion.” I guess I found Scoble his Christmas present.
Comments Off on Persuasion: Best Practices
Omer van Kloeten speculates that the reason no one’s asked me about C# on the JVM as part of the Sun-Microsoft agreement is because the JVM is explicitly the “Java” VM and .NET explicitly decoupled language and VM. Let’s see: according to Jason Bock there are 32 compilers available for .NET. According to Robert Tolksdorf there are 181 compilers for Java (and I didn’t count preprocessors).
Obviously, Java’s been around for a longer time. Obviously, these are both incomplete pages that have experimental, unfinished, and moribund projects. We can talk about platform strategies and how things might be in the future, but as things stand today the JVM is a more diverse platform than .NET
Comments Off on .NET Languages: 32, JVM Languages: 181