HN user

canop_fr

99 karma
Posts0
Comments49
View on HN
No posts found.
Speed Hashing 14 years ago

You're right but that's still in a very small subset of possible hashing functions because you must produce a 4 bytes hash, which is then hashed again (to the length of the storage array). Of course you don't have as requirement to avoid collision, just to distribute as equally as possible.

Speed Hashing 14 years ago

Using chosen hash functions in your applications isn't so rare even outside cryptography field. For example I often use hash for storage addressing (ala git). For this kind of thing you need something fast and with practically no collision (which isn't a requirement for a common hash table).

I think the reasons they don't care more are

1) it mainly affects long time running applications on 32 bits machines. Fact is most production servers are (or should be) on 64 bits

2) most people (me for example) never observed such a phenomenon (and all my dev computers are 32 bits)

So, that's an important problem but far from a game stopper.

For me it's OK. I hadn't see this before and I feel that a discussion without those who don't like Go would be dangerously poor. Thanks for your contribution.

I'm surprised they're on HN but I have a (geeky) friend who do most of his work on an Android tablet so that his "computer" is always on and ready. That makes a difference when you run more than one time in more than on place and you spend a lot of time with your customers too.

It seems to me that if you can buy Fireworks + Illustrator + Photoshop, the difference of price between a Mac and a PC shouldn't be a problem.

Not working on graphics enough to buy those softwares, I'm happy on linux.

Rust 0.2 released 14 years ago

If you want to play, just play with the toy that looks the most fun. Don't plan for the best route, take the most interesting one. There will be enough occasions in your coding life to be serious and not be given a choice...

And it's self-contained in the sense that when you code you may simply launch it locally :

    godoc -http=:6060
Of course this will be less needed now that the API are stable but that what really useful those last months, when my go weekly was almost never exactly like the one described at golang.org nor tip.golang.org. I'll still use it in planes and trains though.

I see a lot of very good reasons for Google not to lose time rewriting Chrome in Go, even without thinking about webkit, but do you have a reference to support this "200ms" assumption ? I never observed this in my programs (which doesn't have the kind of brutal allocations that a browser must have) so I'm curious.

It really depends on your needs and the type of application you're making. For example my applications, apart serving a few static html, css and js files, just answer to JSON or JSONP queries. That can be done in a dozen lines of code, all the remaining code will be related to your application logic.

So you just need to look at the net/http API, and at a few code samples. I cannot find the the old golang wiki codelab sample (has it gone away with Go1 ?), so here's an example of a JSONP server that you can reduce to a few lines if you remove the specific application logic and the profiling hook : https://github.com/Canop/braldop/blob/master/go/src/braldops...

EDIT : I found an example on the golang site. If you're not interested in JSON, it will be more suited to your need : http://golang.org/doc/effective_go.html#web_server

I don't know if I'll be able to go on with that. When I was coding in smalltalk and at the very beginning of java I was happy to use the full power of my speaking language in my programs but I had to give up my accents because most tools were unable to handle them.

Now that (on linux) most tools deal correctly with UTF-8, I try again, at least on programs that I'm sure I won't share with people not understanding French (for example French MMORPG). Time with tell but I don't take this risk at work.

There should be a lot of complementary answers. Here's one.

Go is a fun language to make concise server programs that will run with no surprise (no exception hiding bugs), that you will compile without looking for something else to do during the waiting, that you'll be able to profile easily, that will include foreign libraries easily, and that will run reasonably fast (and they will feel astoundingly fast because you won't have to wait for them to start).

Or they can label versions like sun, so that nobody will know for sure if they're using Go 2 or Go 1.2 or Go Enterprise Edition or Go Standard...

I made a few web application servers (mostly for games) and it's been a real pleasure, not to mention that my programs run for months handling millions of queries (mostly json) without the slightest problem.

Using the go tool to get libraries, build, compile, test, benchmark, is like a dream.

An example of what I found kind of marvelous : I had sometimes queries leading to the call to a function updating a lot of things in a kind of specific database. That is the browser had to wait about 1 second because there was in the query handling code something like this :

    for _, ami := range amis {
    	bra.EnrichitCouchePNG(ms.répertoireCartesBraldun(ami.IdBraldun, ami.Mdpr), couche, PNG_CACHE_SIZE)
    }
I just made a tiny change and the work was done after the answer was sent to the browser :
    for _, ami := range amis {
    	    go bra.EnrichitCouchePNG(ms.répertoireCartesBraldun(ami.IdBraldun, ami.Mdpr), couche, PNG_CACHE_SIZE)
    }
This small go was the only needed thing (the "database" being yet protected by a mutex)

You're right : there is a lot of redundancy in my last sentence. But we're speaking about a non-nonsensical sentence describing an inept process...

I concur about arrays. Each time I make computations in java and I have to either pass offsets and lengths or make arraycopy I regret not to code in Go.

What do you mean ? I you don't use synchronization protection when you access your structures from different threads, you'll have the same inconsistency in your data. Using the explicit Mutex of Go doesn't seem so different than creating an object on which synchronizing your blocks as you do in Java.

Or do I miss something in your comment ?

EDIT : In my opinion, a program that doesn't crash and goes on running with inconsistent data structures is mainly hiding a failure which will appear in a worse way later (for example when those data will be used). To fail fast is often more secure. But my opinion may be based on the fact that I see too many java programs which seem to work but that nobody can touch because they're just in the lucky state where bugs don't surface too much.

You don't read only your code, but also code from other people. Go make it really easy, in my opinion, to fast decipher foreign code, due to shortness, clarity, and conventions. Convention help you recognize in that case the structure of the function without having to make your mind around the habit of the other coder.

As a coder who use mainly weekly (and now use godoc locally each time I need the package documentation), I still find it strange not to have links between release, weekly and tip on top of the documentation pages. Coders have to keep in mind the three links. I see a lot of questions on sites like stackoverflow that would probably not have been asked if the different documentations (and their existence) had been more visible.

And I suppose this small problem won't stop with Go1 as I hope we'll see new progress in weekly as we're used to.

A few comments :

- I find that having a common style about source files from different origins (we're in the open source era) and common naming conventions are great for the readability. I can decipher foreign code much easier if I don't have to set my mind about the bracing style. And seriously, would you prefer to have "private" and "public" all in the place instead of this simple convention ?

- I found it a little painful too, at first, to have to mix source and binary in my projects with the advent of the go tool but the removal of redundant makefiles and its simplicity of use, especially when you deal with a lot of projects and packages from diverse origins is so great that it's hard to protest against that.

- Are you sure you're up to date about map keys ? http://tip.golang.org/ref/spec#Map_types

About this point :

> What's even better: you can put labels on your nested loops and break out of multiple levels using them. Finally!

This is possible in other languages, too, even if it's a little known fact.

For example in java :

    ext: for (int i=0; i<4; i++) {
        System.out.println("ext "+i);
        for (int j=0; j<4; j++) {
            System.out.println(" in "+j);
            if (j==2) break ext;
        }
    }

Yes, that's the driver I'm using. But my question was related to the fact that Google seems to have made (see source) a partial mysql driver, so I was wondering if they were planning to make it database/sql compatible.

What's the point ? Of course all metaphors are wrong and none is a demonstration.

But metaphors are great tools, if wisely used, to reuse mental patterns and find ways to use new tools. What would be the computer without the metaphors of the windows, buttons, files, and so on ?