Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So, if you're a web developer, you probably use Perl, Python, Ruby, or some similar language. Guess what, these are written in C(+). When you need to add or fix a feature, guess what language you use?

(+) Yes, yes, programming languages are not written in anything. Their implementations are. I know you know what I mean.



I hear you, but adding or fixing a feature in Python/Ruby/Perl doesn't ever come up for me. Does it for you? Plus, I understand that much of the standard libraries are written in the high level language.


See if you can find some bottleneck in one of your Python/Ruby/Perl apps that's chewing a lot of CPU time. See if you can devise a definition for a relatively simple function that if it was REALLY FAST would make this hot spot a lot more efficient. Then implement that function in C and expose it to the high level language.

It might not be a good idea to actually use your fast C function in production (if you're new at C you might have a security vulnerability in there, and there could be maintenance headaches). But you'll have learned a lot.


> See if you can find some bottleneck in one of your Python/Ruby/Perl apps that's chewing a lot of CPU time.

I found that hard to do as a starting developer who didn't know what was actually a bottleneck in my code, but I did have a particular library/gem that I wrote myself that did a few things I constantly needed (think of authentication in a web app, it's almost always included). So I rewrite it in C. It didn't really make it faster, or better, but I learned a bunch of C.


> I found that hard to do as a starting developer who didn't know what was actually a bottleneck in my code

That's what a profiler is for! Even experienced developers use them, it's the only reasonable way to find bottlenecks.

> It didn't really make it faster, or better, but I learned a bunch of C.

That works too! :)


I have not needed to add or fix a feature in a programming language but I have needed a ruby gem that uses native extensions (written in C) that are not available for my environment. I know enough C, but I have no idea how to implement this so I can't use it. Thus, instead of calling a few functions in a library I literally have to install another version of ruby, wrap the gem in some high level API, and expose the service via Sinatra, and call it via Net::HTTP. Not fun.

Particularly, libraries search their catalogs using the z39.50 protocol. Ruby 1.8 has a gem ruby-zoom[0] that does this using YAZ[1] however there is not a ruby 1.9 version. If anyone has a guide that explains native extensions for Ruby, please advise.

[0] http://ruby-zoom.rubyforge.org/ [1] http://www.indexdata.com/yaz




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: