I've actually written code lately, although for some reason it's been all these stupid projects. First I needed to fix the kernel tty refcounting, then I got all OCD on the git SHA1 routines.
I don't quite know why I wasted that much time on something as trivial as SHA1 hashing, but it was kind of fun in a "let's use the compiler as a glorified assembler" kind of way. Some people seem to think that C is a real programming language, but they are sadly mistaken. It really is about writing almost-portable assembly language, and it turns out that getting good results from SHA1 really is mostly about trying to fight the compilers tendency to try to be clever.
So here is the current result of me trying to get gcc (well, arguably of it is mostly the C pre-processor, rather than the compiler proper ) to generate good assembly code. On my Nehalem machine (but not Netburst or Atom - poor fragile micro-architectures that they are), it actually seems to outperform the OpenSSL hand-written assembly language implementation.
And once I get rid of libcrypt from openssl, I get rid of two silly runtime loadable libraries that git no longer needs. And that in turn speeds up the test-suite by a couple of seconds.
Did I mention that I seem to have some OCD issues?
Sunday, August 9, 2009
Subscribe to:
Post Comments (Atom)
47 comments:
Lots of issues, but what about Your's vacation? ;)
now that the issue with the ttys is resolved, is alan returning as the maintainer?
@Adrian nerds never go on vacation.
And they're everyday on vacation, as well ;).
That's right @vjt; besides, rest is nothing but change of work! (-;
If someone weren't OCD, nothing would ever get done. ;)
Why not do some real good and turn that OCD on the tty layer?
Mr. Torvalds,
I'm very curious about something: how much CS do your children know?
It's interesting because they're around someone who's extremely well qualified to teach them. Surely, they must ask questions about your work? Does that translate into any real knowledge?
Linus,
You might want to look at http://cr.yp.to/qhasm.html which is more exactly what you discuss, "high level assembly that does not get in the way". It outputs normal assembler.
I bet you could write a sha1 that is even faster that way, and with less pain.
Cheers,
bert
Greetings from Cape Town.
OCD + Nerd-ism = great success.
So keep at it Mr.
Juz
http://juztick.blogspot.com
Nice work, but I'd refactor and shorten all those rounds to something simpler. Seeing the permutations does help understand what is done, but anyone hacking that code should know how SHA1 works. No need to spend 100 lines repeating the obvious.
In programmers, as in airplane mechanics, a little OCD can be a good thing.
Hey..you are right in either way :-).If real implies machine level or more high level english type interpreted one.C is not real :-(.
Programming, what is it??? - A lot of water has run down the "Vantaa River" since I sat in "Helsingin Yliopiston Tietojenkäsittelyopinlaitos" in Töölö in the 70s. As a humanist an a Lutheran theologian I didn't care about "Automaattinen tietojenkäsittelynoppi" back then... but the female students were intellectual.
Haha Linus, people say I have OCD issues too.
I try to optimize my code down to every last instruction. I often look at the compiler output to see what assembly is being generated.
I work in embedded systems though so I can get away with that kind of OCD. If I worked on PC applications I think I would go insane with the amount of inefficiency.
I think when you told that C is not real prog lang then you meant it is not Turing Complaint. But, it is really hard to prove C is not Turing Equivalent. Can you please give one example?. I got to know from search that it can not implement Turing Equivalent recursive functions due to bounded sizeof(void*). Supporting C for TC by implementing Prob Of Tower Of Hanoi : http://bit.ly/5pxIC . The C code for that is http://www0.us.ioccc.org/1995/vanschnitz.c.
Thanks for your reply in advance.
You have Obsessive-Compulsive Disorder???
;)
Hi, Linus! Are you using the Twitter?
Listen to me "mr.god". Linux is fail since you got owned by Alan Cox. He owned you and you couldn't handle it. He solved a problem easy and it was too much for your pride.
Look at the design of linux.org and kernel.ugly.org! I could take a 1hour course from my friend in c++ and I WOULD RAPE YOUR LINUX system today. GET ALAN COX BACK, or you are nothing but a fat little finnish nerd sitting there and thinking you are a god.
PS. I know why you married a kickfighter, because you are a little pussy that need your wife to fight for you..
HAIL ALAN COX! IM HERE FOR YOU BRO <3 R.I.P @ true kernel hacker.
OCD is of great benefit to us programmers, depending on how we use it. Applied correctly, and we can go where no one has gone before.
LOL
I recently came accross your blog and have been reading along. I thought I would leave my first comment. I dont know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.
Susan
http://3128proxy.com
Hey Linus... I'd like to know from you if the correct is GNU/Linux or Linux. Thank you.
Linus
My name is Andrew Chernin and I'm a reporter for a Chilean current affairs magazine. I was writing to you because I wanted to see the possibility of interviewing you, since Linux is turning 18.
Please let me know if there is any chance to work a phone conversation for next week.
Best,
Andrew Chernin
Reporter for Qué Pasa Magazine
Santiago, Chile
56-2-5507503
> I'd like to know from you if the correct is GNU/Linux or Linux. Thank you.
Give him a break. he wanted to call it Phreax. Which would you rather use ? It's "L-i-n-u-x"
Please, linus, give me your mail, please, pleaseeee!
What do you think about the new ChromeOS?
pls email me to emuletas.huineambar@gmail.com
Lol, what's up with all the people trying to whine and contact him through the comments of his blog? lol give him a break!
@Alexander: WTF? Maybe Alan Cox will be missed, but the kernel will march on without him. There are lots of talented folks working on the kernel these days.
As far as OCD goes, I often wonder why things like git are written C in the first place. I can see some routines like SHA1 being accelerated with the use of C code, but realistically, there's no reason that 90% of git couldn't be written in Python, Perl or Ruby. Faster development, less bugs, no need to write stuff like SHA1 routines as they're alreay in the library.
There must be something wrong with terminologies, hasn't this been standardized yet?
Well, the OCD part is but natural... I think anyone of us get that from time to time
=P
You are a GOD !
Thanks for your help !
Wew!.. programming.. I can't take it.. My brain would come into twisted in codes.. gosh!
I spent the evening tuning /sys/block/md? and the knobs in /proc/sys/{vm,net} to try to gain RAID/iSCSI performance. Turns out I managed to get a good boost and then managed to lose it all and then some.
As for OCD, I share your pain. At least you made forward progress.
It could be worse. You could have "CDO". "CDO" is like "OCD" except the letters are in the correct alphabetical order.
Just dropping by!
See yah!
Cathy Young
http://hotgirlsphotocollections.blogspot.com/
Poque o pessoal nao faz uma instalação mais simples do slacware? é uma otima distribuição, mas ficam dificultando o acesso ao usuarios iniciantes.
OCD is a lifestyle...
The SHA1 code actually looks really clean. I'm surprised it would out-perform libcrypt!
I for one sure would like you to get OCD over Linux audio ;)
Itis pretty evident that you're not just OCD about SHA1 routines ;)
Hi there,
I did a C++ experimental version of this, using g++, with the 'template metaprogramming' technique.
http://pastebin.com/f35e12aea
Unfortunatelly, I can't get g++ to generate a single function, but splits it in 3. Nevertheless, it's interesting to see what code it generates. I'll compare both assemblies later.
Daniel.
(of course, -O3)
Despite I didn't do the performance comparison, seems that the C++ code performs really well (far better than the loop-based C code).
Interesting here is that I didn't use the C++ compiler as a fashionable assembler ;-)
Some people seem to think that C is a real programming language, but they are sadly mistaken. It really is about writing almost-portable assembly language
Niin totta!
搬家公司 月子中心 seo 關鍵字廣告 關鍵字 google關鍵字廣告 關鍵字行銷 網路行銷 通姦 徵信社 外遇 桃園房屋仲介 桃園房屋買賣 桃園房屋 醫學美容診所 淨膚雷射 雷射溶脂 飛梭雷射 微晶瓷 植髮 團體服 團體服訂做 醫學美容診所 肉毒桿菌 肉毒桿菌瘦臉 醫學美容 整型診所 美國月子中心 徵信 徵信公司 出軌 清潔公司台北搬家公司 整形 韓風整形 整形 韓風整形 老人癡呆症 情緒管理 訂房網 線上訂房
宜蘭民宿 宜蘭住宿 網路訂房 宜蘭飯店 新娘祕書 清潔公司 植牙 裝潢 室內設計 油漆粉刷 油漆工 油漆工程 洗鞋加盟 洗包包加盟 洗包包 創業加盟店 早餐店加盟 開店創業 創業開店 結婚金飾 鑽石婚戒 通水管 通水管 通馬桶 抽水肥 包通 馬桶不通 通馬桶 通水管 清水溝 沙發 室內設計公司 室內設計 室內裝潢設計 裝潢設計 澳門自由行 搬家公司 搬家公司 台北搬家公司 新竹搬家公司 桃園搬家公司 香港自由行太陽能熱水器 三久 櫻花牌熱水器
熱水器 省電熱水器 衛浴設備 節能減碳 電熱水器 中古車 義賣 義賣活動 二手車 環保袋 環保袋 環保袋 十分瀑布 台北旅遊網 月子餐 飛梭雷射 太陽能熱水器 太陽能 三久太陽能 三久 身體檢查 健康檢查 台北民宿 平溪 景觀餐廳 薰衣草花園 花園餐廳 螢火蟲 渡假村 鐵道之旅 團體服 滷味 滷味加盟 滷味批發 滷味食材 滷味宅配 滷雞翅 滷雞腳 健康滷味 魯味 加盟創業 慈善慈善機構 公益彩券
健康食品 慈善基金會 公益團體 愛心捐款 捐款 美白 皺紋 減肥 禿頭 醫學美容 電波拉皮 雷射溶脂 肉毒桿菌 玻尿酸 痘疤 婦產科診所 室內設計 埋線 內分泌失調 黃體不足 針灸減肥 坐月子中心 婦產科 月子中心 全身健康檢查玫瑰花束 盆栽 網路花店 花店 鍛造 樓梯扶手 欄杆 鐵門 採光罩 清水溝 通水管 通馬桶
Jesus Christ Linus, if I were you I'd put down the keyboard, let go of logic, and learn how to draw or play a musical instrument or some shit.
Give yourself a break and pursue some creative endeavor that you're naturally terrible at. :P
cialis kaufen
zithromax rezeptfrei
lovegra farmacia
silagra online bestellen
cialis vendita farmacia
vigora pharmacie
antabuse prezzo farmacia
acheter pharmacie france
clomid vendita
costo farmacia
viagra vendita italia
trandate senza ricetta
Post a Comment