V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  keakon  ›  全部回复第 49 页 / 共 55 页
回复总数  1086
1 ... 41  42  43  44  45  46  47  48  49  50 ... 55  
2011-01-08 00:41:20 +08:00
回复了 suyu8776 创建的主题 Project Babel v2ex在本地gae环境用dev_appserver.py执行报错
SDK版本升级到1.3.8以上再说
2011-01-07 22:34:54 +08:00
回复了 chuangbo 创建的主题 Python if None 与 if None is None 性能差距1300倍
我测试得和你正好相反:

from timeit import Timer
print Timer('''a=None
if a:pass''').timeit(0xffffff)
print Timer('''a=None
if a is None:pass''').timeit(0xffffff)

前者明显快:
0.599301028483
0.708215988345

而且我执行了1千多万次,相差也只有0.1秒左右,很难相信是它造成的性能瓶颈。

再看字节码,前者是:
0 LOAD_CONST 0 (None)
3 STORE_FAST 0 (a)
6 LOAD_FAST 0 (a)
9 JUMP_IF_FALSE 4 (to 16)

后者是:
0 LOAD_CONST 0 (None)
3 STORE_FAST 0 (a)
6 LOAD_FAST 0 (a)
9 LOAD_CONST 0 (None)
12 COMPARE_OP 8 (is)
15 JUMP_IF_FALSE 4 (to 22)

明显前者少执行了2条语句,没有理由更慢
2011-01-07 22:00:53 +08:00
回复了 CupTools 创建的主题 Python "Python/PHP is the same shit"
@reus 首先确认你问的是不是这个: http://wiki.php.net/rfc/traits

粗略看了下,类似于Ruby的mixin。

A Trait is a unit of reuse much like a class, but only intended to group functionality in a fine-grained and consistent way.
Python是支持多继承的,所以没有traits。

简单来说,这个问题好比拿了台手机,然后问别人你的电脑键盘可以敲3下2打出个c么?
2011-01-07 15:21:54 +08:00
回复了 apoclast 创建的主题 问与答 怎么样才能保持每天早睡早起
想早睡早起?往东移民就行了。习惯2点睡就移民到东10区,以此类推。或者每天移几个时区,天天住宾馆。
2011-01-07 00:56:43 +08:00
回复了 keakon 创建的主题 iPhone 上海哪买联通版的iPhone4最快捷?
@yelusiku 谢谢,不过用不到了。前天已经和一个联通的经理联系了,今天去拿货~
2011-01-06 10:03:32 +08:00
回复了 Livid 创建的主题 ACG 推荐一款 H-Game 吧
AIR、智代After、Fate/Stay Night、真月谭月姬、恋狱~月狂病~、加奈…欢迎回来!!
"临汾" -"临汾路"
2011-01-03 15:36:49 +08:00
回复了 ayanamist 创建的主题 Twitter 求个Twitter产品名
叫“我呸”
2011-01-03 12:18:45 +08:00
回复了 julia 创建的主题 Google App Engine Entity key有没办法缩短?
转换的开销少于1ms,你愿意写很长的key为了这不到1ms的开销么…
2011-01-03 11:18:25 +08:00
回复了 julia 创建的主题 Google App Engine Entity key有没办法缩短?
是的,前面2个最终都是转换成get()
2011-01-03 10:55:46 +08:00
回复了 julia 创建的主题 Google App Engine Entity key有没办法缩短?
用id啊,然后自己构造key
2011-01-03 10:43:15 +08:00
回复了 CupTools 创建的主题 Python "Python/PHP is the same shit"
Actually, for most web apps, language is not the bottleneck.
Rendering an page normally costs less than 10ms, while the database accessing and network latency are much more expansive than it (maybe hundreds or thousand ms).

I don't think Java could do it better since it took more time for rendering a same dynamic JSP page and connecting to MySQL in my previous testing.
Don't think dynamic languages are always slow than static languages, you'll find the answer when you need dynamic features.

In my opinion, Java is almost the worst choice which makes everything much much more complex (normally 10x code lines), uses much much more memories (normally 3x memory usage), and also takes much much more money to buy suitable servers.

I've been a Java coder for years, I couldn't find any interesting of it.
The only superiority of Java coders I found was coming from the performance of toy programs. Otherwise, I can't explain why your friend likes complaining by using "shit" while Pythoners don't.
2011-01-02 18:39:21 +08:00
回复了 deepice 创建的主题 Google App Engine 有GAE上运行用来URL缩短的开源应用么?
2011-01-02 18:05:06 +08:00
回复了 Livid 创建的主题 Google App Engine 如果你在部署 GAE 应用时发现 SSL 通讯被干扰
其实上传时写上set HTTPS_PROXY=http://localhost:7777就行了…
2011-01-02 18:01:55 +08:00
回复了 deepice 创建的主题 Google App Engine 有GAE上运行用来URL缩短的开源应用么?
前几天还看到有人做短网址应用而被Google暂停服务了。Google指出提供这种服务必须要有能力和精力确保不被用于spam和恶意网站。
1 ... 41  42  43  44  45  46  47  48  49  50 ... 55  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2724 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 33ms · UTC 14:19 · PVG 22:19 · LAX 06:19 · JFK 09:19
Developed with CodeLauncher
♥ Do have faith in what you're doing.