続:CPythonよりPyPyの方が遅かった話。

前回、PyPyでのRPythonコードのコンパイルがCPythonのそれより遅かったのだけど、その続きの話。

Topazを念のためCPythonとPyPyのそれぞれでコンパイルして、時間を比較した。

結果

TopazのコンパイルにおいてはCPythonよりPyPyの方が速かった。うーむ。

PyPy

[Timer] Total: --- 1311.6 s

CPython

[Timer] Total: --- 1631.5 s

PyPy

ログ貼ったら、262976文字に達して投稿できなかったので省略。

CPython

同上

CPythonよりPyPyの方が遅かった話。

書き始めたRPythonコードをCPythonとPyPyでコンパイルしたら、表題のとおりになった話。

  • PyPy2.0.2
(_)ike-no-MacBook-Air% pypy -V
Python 2.7.3 (5acfe049a5b0, May 21 2013, 13:47:22)
[PyPy 2.0.2 with GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)]
  • CPython
ike-no-MacBook-Air% python -V
Python 2.7.2

結果

PyPy

[Timer] Total: --- 69.8 s

CPython

[Timer] Total: --- 25.6 s

PyPy

(_)ike-no-MacBook-Air% make
python /Users/rokujyouhitoma/workspace/bitbucket.org/pypy.origin/rpython/bin/rpython --opt=2 targetr12a.py
[translation:info] 2.7.3 (5acfe049a5b0, May 21 2013, 13:47:22)
[translation:info] [PyPy 2.0.2 with GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)]
[platform:msg] Set platform with 'host' cc=None, using cc='clang'
[translation:info] Translating target as defined by targetr12a
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/gcctest.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/gcctest.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/gcctest.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/gcctest
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/gcctest.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/gcctest.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/gcctest.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/gcctest
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_0.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_0.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_0.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_0
[translation] translate.py configuration:
[translation] [translate]
[translation]     opt = 2
[translation]     targetspec = targetr12a
[translation] translation configuration:
[translation] [translation]
[translation]     gc = minimark
[translation]     gctransformer = framework
[translation]     list_comprehension_operations = True
[translation]     withsmallfuncsets = 5
[translation:info] Annotating&simplifying...
[d7] {translation-task
starting annotate
[translation:info] with policy: rpython.annotator.policy.AnnotatorPolicy
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_1.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_1.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_1.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_1
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_2.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_2.o
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_3.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_3.o
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_4.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_4.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_4.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_4
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_5.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_5.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_5.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_5
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_6.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_6.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_6.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_6
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_7.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_7.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_7.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_7
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_8.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_8.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_8.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_8
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_9.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_9.o
[platform:WARNING] /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_9.c:42:1: warning: expression result unused [-Wunused-value]
[platform:WARNING] utimes;
[platform:WARNING] ^~~~~~
[platform:WARNING] 1 warning generated.
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_9.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_9
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_10.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_10.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_10.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_10
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_11.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_11.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_11.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_11
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic -I/Users/rokujyouhitoma/workspace/bitbucket.org/pypy.origin/rpython/translator/c /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_12.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_12.o
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic -I/Users/rokujyouhitoma/workspace/bitbucket.org/pypy.origin/rpython/translator/c /Users/rokujyouhitoma/workspace/bitbucket.org/pypy.origin/rpython/translator/c/src/thread.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/rpython/translator/c/src/thread.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_12.o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/rpython/translator/c/src/thread.o -arch x86_64 -mmacosx-version-min=10.5 -Wl,-exported_symbols_list,/var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/dynamic-symbols-0 -I/Users/rokujyouhitoma/workspace/bitbucket.org/pypy.origin/rpython/translator/c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_12
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_13.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_13.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_13.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_13
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_14.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_14.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_14.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_14
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_15.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_15.o
[platform:WARNING] /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_15.c:50:1: warning: expression result unused [-Wunused-value]
[platform:WARNING] ftime;
[platform:WARNING] ^~~~~
[platform:WARNING] 1 warning generated.
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_15.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_15
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_16.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_16.o
[platform:WARNING] /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_16.c:50:1: warning: expression result unused [-Wunused-value]
[platform:WARNING] gettimeofday;
[platform:WARNING] ^~~~~~~~~~~~
[platform:WARNING] 1 warning generated.
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_16.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_16
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_17.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_17.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_17.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_17
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_18.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_18.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_18.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_18
...+++++++++++++++*****[19c] translation-task}

[translation:info] RTyping...
[19c] {translation-task
starting rtype_lltype
...+++++++++++++++*************************%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%###################################################%###########%%
[rtyper] specializing: 100 / 602 blocks   (16%)
...+++++++++++++++*************************%%%%%%%%%%%
[rtyper] specializing: 200 / 839 blocks   (23%)
[rtyper] specializing: 300 / 839 blocks   (35%)
[rtyper] specializing: 400 / 839 blocks   (47%)
[rtyper] specializing: 500 / 839 blocks   (59%)
.
[rtyper] specializing: 600 / 844 blocks   (71%)
[rtyper] specializing: 700 / 844 blocks   (82%)
[rtyper] specializing: 800 / 844 blocks   (94%)
[rtyper] -=- specialized 844 blocks -=-
...+++++++++++++++*********
[rtyper] specializing: 900 / 1027 blocks   (87%)
[rtyper] specializing: 1000 / 1027 blocks   (97%)
..
[rtyper] -=- specialized 187 more blocks -=-
...
[rtyper] -=- specialized 7 more blocks -=-
[5f2] translation-task}
[translation:info] lltype back-end optimisations...
[5f2] {translation-task
starting backendopt_lltype
[backendopt:inlining] phase with threshold factor: 32.4
[backendopt:inlining] heuristic: rpython.translator.backendopt.inline.inlining_heuristic
...+++++++++++++++*************************%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%###################################################%###########%%%##%**************
.++++++++++++++*
[backendopt:inlining] inlined 315 callsites.
[backendopt:malloc] starting malloc removal
.++++++++++++++*****************
[backendopt:malloc] removed 118 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
[8ac] translation-task}
[translation:info] inserting stack checks...
[8ac] {translation-task
starting stackcheckinsertion_lltype
.+
[rtyper] -=- specialized 7 more blocks -=-
[translation:info] inserted 0 stack checks.
[8ba] translation-task}
[translation:info] Creating database for generating c source...
[8ba] {translation-task
starting database_c
.++++++++++
[rtyper] -=- specialized 25 more blocks -=-
.++++++++++++++*********************%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%###################################################################%%#%%*************
++++++++++++*******************%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%###################################################################%%%%%%%%
[rtyper:WARNING] prebuilt instance <rpython.memory.gctypelayout.GCData object at 0x000000010a2d9c90> has no attribute 'root_stack_top'
[rtyper:WARNING] prebuilt instance <rpython.memory.gctypelayout.GCData object at 0x000000010a2d9c90> has no attribute 'root_stack_base'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'young_objects_with_light_finalizers'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'initial_cleanup'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'young_rawmalloced_objects'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'rawmalloced_total_size'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'next_major_collection_initial'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'old_objects_with_light_finalizers'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute '_debug_pending'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute '_list_rpy'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'tmpstack'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute '_callback2_arg4'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute '_debug_seen'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute '_callback2_arg2'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute '_callback2_arg3'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'nursery_objects_shadows'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'young_objects_with_weakrefs'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'old_objects_with_weakrefs'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'next_major_collection_threshold'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'old_rawmalloced_objects'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'objects_to_trace'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'objects_with_finalizers'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute '_count_rpy'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute '_callback2_arg0'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute '_callback2_arg1'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'finalizer_lock_count'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x000000010a2d9948> has no attribute 'run_finalizers'
+
[rtyper] specializing: 1100 / 2574 blocks   (42%)
+++++
[rtyper] specializing: 1300 / 2588 blocks   (50%)
+++++++++++
[rtyper] specializing: 1500 / 2620 blocks   (57%)
++++++++++++*****
[rtyper] specializing: 1700 / 2656 blocks   (64%)
+++++++
[rtyper] specializing: 1900 / 2656 blocks   (71%)
++++++++++
[rtyper] specializing: 2100 / 2656 blocks   (79%)
+++
[rtyper] specializing: 2300 / 2660 blocks   (86%)
++++++
[rtyper] specializing: 2500 / 2660 blocks   (93%)
+++
[rtyper] specializing: 2600 / 2668 blocks   (97%)
[rtyper] -=- specialized 1598 more blocks -=-
+++++++++[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_19.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_19.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_19.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_19
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_20.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_20.o
[platform:WARNING] /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_20.c:44:1: warning: implicit declaration of function 'mremap' is invalid in C99 [-Wimplicit-function-declaration]
[platform:WARNING] mremap(NULL, 0, 0, 0);
[platform:WARNING] ^
[platform:WARNING] 1 warning generated.
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_20.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_20
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_21.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_21.o
[platform:WARNING] /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_21.c:45:20: warning: implicit declaration of function 'getpagesize' is invalid in C99 [-Wimplicit-function-declaration]
[platform:WARNING]         long int result = getpagesize();
[platform:WARNING]                           ^
[platform:WARNING] 1 warning generated.
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_21.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/platcheck_21
+++********
[rtyper] specializing: 2700 / 2941 blocks   (91%)
++++
[rtyper] specializing: 2900 / 2956 blocks   (98%)
+
[rtyper] -=- specialized 290 more blocks -=-
[backendopt:inlining] phase with threshold factor: 32.4
[backendopt:inlining] heuristic: rpython.translator.backendopt.inline.inlining_heuristic
++++++++++++*******************%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%###################################################################%%%%%%%%%*********
++++++++++*****************%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%##############
[backendopt:inlining] inlined 1001 callsites.
[backendopt:malloc] starting malloc removal
+++++
[backendopt:malloc] removed 26 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
+++++++
[rtyper:WARNING] prebuilt instance Ellipsis has no attribute 'errno'
[rtyper] -=- specialized 15 more blocks -=-
++
[rtyper] specializing: 3000 / 3006 blocks   (99%)
[rtyper] -=- specialized 33 more blocks -=-
[backendopt:inlining] phase with threshold factor: 32.4
[backendopt:inlining] heuristic: rpython.translator.backendopt.inline.inlining_heuristic
+++
[backendopt:inlining] inlined 4 callsites.
[backendopt:malloc] starting malloc removal
[backendopt:malloc] removed 0 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
[c:database] GC transformer: finished helpers
[c:database] GC transformer: finished tables
[gctransform:info] assigned 51 typeids
[gctransform:info] added 100 push/pop stack root instructions
[gctransform:info] inserted 9 write barrier calls
[gctransform:info] inserted 8 write_barrier_from_array calls
[gctransform:info] found 2 static roots
[c]      622 nodes  [ array: 109  framework rtti: 19  func: 181  group: 1  struct: 312 ]
[c:database] Completed
[translation:info] database for generating C source was created
[1702] translation-task}
[translation:info] Generating c source...
[1702] {translation-task
starting source_c
[c:writing] structdef.h
[c:writing] forwarddecl.h
[c:writing] preimpl.h
[c:writing] data_r12a_main.c
[c:writing] data_rpython_memory_gc_env.c
[c:writing] data_rpython_memory_gc_minimark.c
[c:writing] data_rpython_memory_gctransform_framework.c
[c:writing] data_rpython_rlib_rdtoa.c
[c:writing] data_rpython_rtyper_lltypesystem_rclass.c
[c:writing] data_rpython_rtyper_lltypesystem_rdict.c
[c:writing] nonfuncnodes.c
[c:writing] data_rpython_memory_gc_minimark_1.c
[c:writing] data_rpython_rlib_entrypoint.c
[c:writing] data_rpython_rtyper_lltypesystem_rffi.c
[c:writing] data_rpython_rtyper_module_ll_os.c
[c:writing] implement.c
[c:writing] r12a_main.c
[c:writing] rpython_memory_gc_base.c
[c:writing] rpython_memory_gc_env.c
[c:writing] rpython_memory_gc_minimark.c
[c:writing] rpython_memory_gc_minimarkpage.c
[c:writing] rpython_memory_gctransform_framework.c
[c:writing] rpython_memory_gctransform_shadowstack.c
[c:writing] rpython_memory_gctransform_transform.c
[c:writing] rpython_memory_lldict.c
[c:writing] rpython_memory_support.c
[c:writing] rpython_rlib_entrypoint.c
[c:writing] rpython_rlib_rdtoa.c
[c:writing] rpython_rlib_rgc.c
[c:writing] rpython_rlib_rposix.c
[c:writing] rpython_rtyper_exceptiondata.c
[c:writing] rpython_rtyper_lltypesystem_ll_str.c
[c:writing] rpython_rtyper_lltypesystem_rbuilder.c
[c:writing] rpython_rtyper_lltypesystem_rclass.c
[c:writing] rpython_rtyper_lltypesystem_rdict.c
[c:writing] rpython_rtyper_lltypesystem_rffi.c
[c:writing] rpython_rtyper_lltypesystem_rlist.c
[c:writing] rpython_rtyper_lltypesystem_rstr.c
[c:writing] rpython_rtyper_module_ll_os.c
[c:writing] rpython_rtyper_module_ll_os_environ.c
[c:writing] rpython_rtyper_module_ll_os_stat.c
[c:writing] rpython_rtyper_rlist.c
[c:writing] rpython_rtyper_rrange.c
[c:writing] rpython_rtyper_rstr.c
[c:writing] rpython_translator_c_extfunc.c
[c:writing] rpython_translator_exceptiontransform.c
[translation:info] written: /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/testing_1/testing_1.c
[1a7d] translation-task}
[translation:info] Compiling c source...
[1a7d] {translation-task
starting compile_c
[platform:execute] make -j 4 in /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45/testing_1
[platform:WARNING] rpython_rtyper_lltypesystem_rffi.c:28:12: warning: implicit declaration of function 'sysctlbyname' is invalid in C99 [-Wimplicit-function-declaration]
[platform:WARNING]         l_v8272 = sysctlbyname(l_v8271, l_stararg1_0, l_stararg2_3, ((void *) NULL), l_stararg4_0);
[platform:WARNING]                   ^
[platform:WARNING] 1 warning generated.
[translation:info] usession directory: /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-45
[translation:info] created: /Users/rokujyouhitoma/workspace/r12a/bin/r12a
[1a80] translation-task}
[Timer] Timings:
[Timer] annotate                       ---  3.0 s
[Timer] rtype_lltype                   --- 11.1 s
[Timer] backendopt_lltype              ---  7.1 s
[Timer] stackcheckinsertion_lltype     ---  0.1 s
[Timer] database_c                     --- 37.0 s
[Timer] source_c                       ---  8.9 s
[Timer] compile_c                      ---  2.5 s
[Timer] =========================================
[Timer] Total:                         --- 69.8 s

CPython

ike-no-MacBook-Air% make      
python /Users/rokujyouhitoma/workspace/bitbucket.org/pypy.origin/rpython/bin/rpython --opt=2 targetr12a.py
[translation:info] 2.7.2 (default, Jun 20 2012, 16:23:33)
[translation:info] [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
[platform:msg] Set platform with 'host' cc=None, using cc='clang'
[translation:info] Translating target as defined by targetr12a
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/gcctest.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/gcctest.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/gcctest.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/gcctest
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/gcctest.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/gcctest.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/gcctest.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/gcctest
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_0.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_0.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_0.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_0
[translation] translate.py configuration:
[translation] [translate]
[translation]     opt = 2
[translation]     targetspec = targetr12a
[translation] translation configuration:
[translation] [translation]
[translation]     gc = minimark
[translation]     gctransformer = framework
[translation]     list_comprehension_operations = True
[translation]     withsmallfuncsets = 5
[translation:info] Annotating&simplifying...
[65] {translation-task
starting annotate
[translation:info] with policy: rpython.annotator.policy.AnnotatorPolicy
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_1.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_1.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_1.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_1
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_2.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_2.o
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_3.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_3.o
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_4.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_4.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_4.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_4
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_5.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_5.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_5.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_5
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_6.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_6.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_6.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_6
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_7.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_7.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_7.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_7
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_8.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_8.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_8.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_8
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_9.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_9.o
[platform:WARNING] /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_9.c:42:1: warning: expression result unused [-Wunused-value]
[platform:WARNING] utimes;
[platform:WARNING] ^~~~~~
[platform:WARNING] 1 warning generated.
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_9.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_9
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_10.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_10.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_10.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_10
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_11.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_11.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_11.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_11
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic -I/Users/rokujyouhitoma/workspace/bitbucket.org/pypy.origin/rpython/translator/c /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_12.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_12.o
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic -I/Users/rokujyouhitoma/workspace/bitbucket.org/pypy.origin/rpython/translator/c /Users/rokujyouhitoma/workspace/bitbucket.org/pypy.origin/rpython/translator/c/src/thread.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/rpython/translator/c/src/thread.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_12.o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/rpython/translator/c/src/thread.o -arch x86_64 -mmacosx-version-min=10.5 -Wl,-exported_symbols_list,/var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/dynamic-symbols-0 -I/Users/rokujyouhitoma/workspace/bitbucket.org/pypy.origin/rpython/translator/c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_12
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_13.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_13.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_13.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_13
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_14.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_14.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_14.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_14
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_15.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_15.o
[platform:WARNING] /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_15.c:50:1: warning: expression result unused [-Wunused-value]
[platform:WARNING] ftime;
[platform:WARNING] ^~~~~
[platform:WARNING] 1 warning generated.
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_15.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_15
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_16.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_16.o
[platform:WARNING] /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_16.c:50:1: warning: expression result unused [-Wunused-value]
[platform:WARNING] gettimeofday;
[platform:WARNING] ^~~~~~~~~~~~
[platform:WARNING] 1 warning generated.
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_16.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_16
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_17.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_17.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_17.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_17
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_18.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_18.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_18.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_18
...+++++++++++++++*****[a3] translation-task}

[translation:info] RTyping...
[a3] {translation-task
starting rtype_lltype
...+++++++++++++++*************************%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%###################################################%###########%%%##%**************
.++++++++++++++*****
[rtyper] specializing: 100 / 789 blocks   (12%)
.++++++++++++++*
[rtyper] specializing: 200 / 839 blocks   (23%)
[rtyper] specializing: 300 / 839 blocks   (35%)
.
[rtyper] specializing: 400 / 844 blocks   (47%)
[rtyper] specializing: 500 / 844 blocks   (59%)
[rtyper] specializing: 600 / 844 blocks   (71%)
[rtyper] specializing: 700 / 844 blocks   (82%)
[rtyper] specializing: 800 / 844 blocks   (94%)
[rtyper] -=- specialized 844 blocks -=-
.++++++++++++++************
[rtyper] specializing: 900 / 1027 blocks   (87%)
.+
[rtyper] specializing: 1000 / 1031 blocks   (96%)
[rtyper] -=- specialized 187 more blocks -=-
.++
[rtyper] -=- specialized 7 more blocks -=-
[1da] translation-task}
[translation:info] lltype back-end optimisations...
[1da] {translation-task
starting backendopt_lltype
[backendopt:inlining] phase with threshold factor: 32.4
[backendopt:inlining] heuristic: rpython.translator.backendopt.inline.inlining_heuristic
.++++++++++++++*********************%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%###################################################################%%#%%*************
++++++++++++****
[backendopt:inlining] inlined 321 callsites.
[backendopt:malloc] starting malloc removal
++++++++++++*******************%
[backendopt:malloc] removed 118 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
[258] translation-task}
[translation:info] inserting stack checks...
[258] {translation-task
starting stackcheckinsertion_lltype
++
[rtyper] -=- specialized 7 more blocks -=-
[translation:info] inserted 0 stack checks.
[25b] translation-task}
[translation:info] Creating database for generating c source...
[25b] {translation-task
starting database_c
+++++++++++
[rtyper] -=- specialized 25 more blocks -=-
++++++++++++*******************%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%###################################################################%%%%%%%%%*********
++++++++++*****************%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%##########################################################################%%%%%%%%%%%%
[rtyper] specializing: 1100 / 2574 blocks   (42%)
++
[rtyper:WARNING] prebuilt instance <rpython.memory.gctypelayout.GCData object at 0x10698f090> has no attribute 'root_stack_top'
[rtyper:WARNING] prebuilt instance <rpython.memory.gctypelayout.GCData object at 0x10698f090> has no attribute 'root_stack_base'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'young_objects_with_light_finalizers'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'initial_cleanup'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'young_rawmalloced_objects'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'rawmalloced_total_size'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'next_major_collection_initial'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'old_objects_with_light_finalizers'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute '_debug_pending'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute '_list_rpy'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'tmpstack'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute '_callback2_arg4'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute '_debug_seen'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'finalizer_lock_count'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute '_callback2_arg3'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'nursery_objects_shadows'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'young_objects_with_weakrefs'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'old_objects_with_weakrefs'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'next_major_collection_threshold'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'old_rawmalloced_objects'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'objects_to_trace'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'objects_with_finalizers'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute '_count_rpy'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute '_callback2_arg0'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute '_callback2_arg1'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute '_callback2_arg2'
[rtyper:WARNING] prebuilt instance <rpython.memory.gc.minimark.MiniMarkGC object at 0x10698f0d0> has no attribute 'run_finalizers'
+++++
[rtyper] specializing: 1300 / 2593 blocks   (50%)
++++++++++******
[rtyper] specializing: 1500 / 2632 blocks   (56%)
++++++
[rtyper] specializing: 1700 / 2636 blocks   (64%)
++++++++
[rtyper] specializing: 1900 / 2645 blocks   (71%)
+++++
[rtyper] specializing: 2100 / 2656 blocks   (79%)
+++++++
[rtyper] specializing: 2300 / 2660 blocks   (86%)
++++++
[rtyper] specializing: 2500 / 2660 blocks   (93%)
+++
[rtyper] specializing: 2600 / 2660 blocks   (97%)
++
[rtyper] -=- specialized 1598 more blocks -=-
++++++++++*[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_19.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_19.o
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_19.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_19
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_20.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_20.o
[platform:WARNING] /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_20.c:44:1: warning: implicit declaration of function 'mremap' is invalid in C99 [-Wimplicit-function-declaration]
[platform:WARNING] mremap(NULL, 0, 0, 0);
[platform:WARNING] ^
[platform:WARNING] 1 warning generated.
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_20.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_20
[platform:execute] clang -c -arch x86_64 -O3 -fomit-frame-pointer -mmacosx-version-min=10.5 -mdynamic-no-pic /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_21.c -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_21.o
[platform:WARNING] /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_21.c:45:20: warning: implicit declaration of function 'getpagesize' is invalid in C99 [-Wimplicit-function-declaration]
[platform:WARNING]         long int result = getpagesize();
[platform:WARNING]                           ^
[platform:WARNING] 1 warning generated.
[platform:execute] clang /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_21.o -arch x86_64 -mmacosx-version-min=10.5 -o /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/platcheck_21
********
[rtyper] specializing: 2700 / 2926 blocks   (92%)
++++
[rtyper] specializing: 2900 / 2942 blocks   (98%)
++
[rtyper] -=- specialized 290 more blocks -=-
[backendopt:inlining] phase with threshold factor: 32.4
[backendopt:inlining] heuristic: rpython.translator.backendopt.inline.inlining_heuristic
++++++++++*****************%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%##########################################################################%%%%%%%%%%%%%******
++++++++****************#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%###########
[backendopt:inlining] inlined 994 callsites.
[backendopt:malloc] starting malloc removal
+++++
[backendopt:malloc] removed 26 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
+++++++
[rtyper:WARNING] prebuilt instance Ellipsis has no attribute 'errno'
[rtyper] -=- specialized 15 more blocks -=-
++
[rtyper] specializing: 3000 / 3006 blocks   (99%)
[rtyper] -=- specialized 33 more blocks -=-
[backendopt:inlining] phase with threshold factor: 32.4
[backendopt:inlining] heuristic: rpython.translator.backendopt.inline.inlining_heuristic
+++
[backendopt:inlining] inlined 4 callsites.
[backendopt:malloc] starting malloc removal
[backendopt:malloc] removed 0 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
[c:database] GC transformer: finished helpers
[c:database] GC transformer: finished tables
[gctransform:info] assigned 51 typeids
[gctransform:info] added 100 push/pop stack root instructions
[gctransform:info] inserted 9 write barrier calls
[gctransform:info] inserted 8 write_barrier_from_array calls
[gctransform:info] found 2 static roots
[c]      622 nodes  [ array: 109  framework rtti: 19  func: 181  group: 1  struct: 312 ]
[c:database] Completed
[translation:info] database for generating C source was created
[757] translation-task}
[translation:info] Generating c source...
[757] {translation-task
starting source_c
[c:writing] structdef.h
[c:writing] forwarddecl.h
[c:writing] preimpl.h
[c:writing] data_r12a_main.c
[c:writing] data_rpython_memory_gc_env.c
[c:writing] data_rpython_memory_gc_minimark.c
[c:writing] data_rpython_memory_gctransform_framework.c
[c:writing] data_rpython_rlib_rdtoa.c
[c:writing] data_rpython_rtyper_lltypesystem_rclass.c
[c:writing] data_rpython_rtyper_lltypesystem_rdict.c
[c:writing] nonfuncnodes.c
[c:writing] data_rpython_memory_gc_minimark_1.c
[c:writing] data_rpython_rlib_entrypoint.c
[c:writing] data_rpython_rtyper_lltypesystem_rffi.c
[c:writing] data_rpython_rtyper_module_ll_os.c
[c:writing] implement.c
[c:writing] r12a_main.c
[c:writing] rpython_memory_gc_base.c
[c:writing] rpython_memory_gc_env.c
[c:writing] rpython_memory_gc_minimark.c
[c:writing] rpython_memory_gc_minimarkpage.c
[c:writing] rpython_memory_gctransform_framework.c
[c:writing] rpython_memory_gctransform_shadowstack.c
[c:writing] rpython_memory_gctransform_transform.c
[c:writing] rpython_memory_lldict.c
[c:writing] rpython_memory_support.c
[c:writing] rpython_rlib_entrypoint.c
[c:writing] rpython_rlib_rdtoa.c
[c:writing] rpython_rlib_rgc.c
[c:writing] rpython_rlib_rposix.c
[c:writing] rpython_rtyper_exceptiondata.c
[c:writing] rpython_rtyper_lltypesystem_ll_str.c
[c:writing] rpython_rtyper_lltypesystem_rbuilder.c
[c:writing] rpython_rtyper_lltypesystem_rclass.c
[c:writing] rpython_rtyper_lltypesystem_rdict.c
[c:writing] rpython_rtyper_lltypesystem_rffi.c
[c:writing] rpython_rtyper_lltypesystem_rlist.c
[c:writing] rpython_rtyper_lltypesystem_rstr.c
[c:writing] rpython_rtyper_module_ll_os.c
[c:writing] rpython_rtyper_module_ll_os_environ.c
[c:writing] rpython_rtyper_module_ll_os_stat.c
[c:writing] rpython_rtyper_rlist.c
[c:writing] rpython_rtyper_rrange.c
[c:writing] rpython_rtyper_rstr.c
[c:writing] rpython_translator_c_extfunc.c
[c:writing] rpython_translator_exceptiontransform.c
[translation:info] written: /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/testing_1/testing_1.c
[8fa] translation-task}
[translation:info] Compiling c source...
[8fa] {translation-task
starting compile_c
[platform:execute] make -j 4 in /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46/testing_1
[platform:WARNING] rpython_rtyper_lltypesystem_rffi.c:28:12: warning: implicit declaration of function 'sysctlbyname' is invalid in C99 [-Wimplicit-function-declaration]
[platform:WARNING]         l_v8273 = sysctlbyname(l_v8274, l_stararg1_0, l_stararg2_0, ((void *) NULL), l_stararg4_0);
[platform:WARNING]                   ^
[platform:WARNING] 1 warning generated.
[translation:info] usession directory: /var/folders/lc/vw5blb150gxd3_xwxj2k3s080000gn/T/usession-default-46
[translation:info] created: /Users/rokujyouhitoma/workspace/r12a/bin/r12a
[8fb] translation-task}
[Timer] Timings:
[Timer] annotate                       ---  1.6 s
[Timer] rtype_lltype                   ---  3.1 s
[Timer] backendopt_lltype              ---  1.3 s
[Timer] stackcheckinsertion_lltype     ---  0.0 s
[Timer] database_c                     --- 13.0 s
[Timer] source_c                       ---  4.2 s
[Timer] compile_c                      ---  2.4 s
[Timer] =========================================
[Timer] Total:                         --- 25.6 s

一言

何が原因でしょうね...ひとまず、原因究明よりCPythonで続きする。コードでかくなってきたら逆転するかもだから、コード増やす。

virtualenvのバージョンが古いとPyPyの環境がうまく作れない。

rubykaigi2013で@matzが言語作ろうよ!的な発表してたので、RPython toolchain使って以前作ったOok!を元にちょっと言語らしくしてみるかと思った。
RPythonのコンパイルはCPythonだと時間かかるので、PyPyでコンパイルすれば時間節約できてー(゚д゚)ウマー。というのを目指す。

で、表題の件で引っかかったので。

  • PyPy2.0.2

失敗した場合は下記の通り。(virtualenvwrapper使ってますが、virtualenvでも同様)

ike-no-MacBook-Air% virtualenv -p /Users/rokujyouhitoma/usr/local/src/pypy-2.0.2/bin/pypy _                                
Running virtualenv with interpreter /Users/rokujyouhitoma/usr/local/src/pypy-2.0.2/bin/pypy
New pypy executable in _/bin/pypy
debug: WARNING: Library path not found, using compiled-in sys.path.
debug: WARNING: 'sys.prefix' will not be set.
debug: WARNING: Make sure the pypy binary is kept inside its tree of files.
debug: WARNING: It is ok to create a symlink to it from somewhere else.
debug: OperationError:
debug:  operror-type: ImportError
debug:  operror-value: No module named os
ERROR: The executable _/bin/pypy is not functioning
ERROR: It thinks sys.prefix is u'/Users/rokujyouhitoma' (should be u'/Users/rokujyouhitoma/_')
ERROR: virtualenv is not compatible with this system or executable

解決策

virtualenvのバージョンを最新にする。

-no-MacBook-Air% sudo easy_install -U virtualenv
Password:
Searching for virtualenv
Reading http://pypi.python.org/simple/virtualenv/
Best match: virtualenv 1.9.1
Downloading http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz#md5=07e09df0adfca0b2d487e39a4bf2270a
Processing virtualenv-1.9.1.tar.gz
Writing /tmp/easy_install-dDdnB2/virtualenv-1.9.1/setup.cfg
Running virtualenv-1.9.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-dDdnB2/virtualenv-1.9.1/egg-dist-tmp-NJo0g9
warning: no previously-included files matching '*' found under directory 'docs/_templates'
warning: no previously-included files matching '*' found under directory 'docs/_build'
Removing virtualenv 1.8.3 from easy-install.pth file
Adding virtualenv 1.9.1 to easy-install.pth file
Installing virtualenv script to /usr/local/bin
Installing virtualenv-2.7 script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/virtualenv-1.9.1-py2.7.egg
Processing dependencies for virtualenv
Finished processing dependencies for virtualenv

再度トライ

ike-no-MacBook-Air% mkvirtualenv _ --no-site-packages --distribute --python=/Users/rokujyouhitoma/usr/local/src/pypy-2.0.2/bin/pypy
Running virtualenv with interpreter /Users/rokujyouhitoma/usr/local/src/pypy-2.0.2/bin/pypy
Overwriting _/lib-python/2.7/site.py with new content
New pypy executable in _/bin/pypy
Installing distribute...........................................................................................................................................................................................................................done.
Installing pip................done.

うまくいった。

NLTKで頻出単語抽出(英単語のみ)まえの環境構築

オンライン講座の動画観てたら、英語の学習レベルが低すぎて真剣にやらないとまずいな...と。

これはいかんということで、オンライン講座の動画と対になっている字幕の英語テキストデータから頻度順に英単語並べたりして、学習しようと思ってる。

そのために、NLTKの環境がほしい。できれば仮想環境で。いま流行ってるvagrant使ったことなかったのでついでに学習。

環境構築

vagrant

初めてvagrant使ったのだけど、便利だった。

% sudo gem install vagrant
% vagrant box add centos http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.3-x86_64-v20130101.box
% vagrant init centos
% vagrant up

Python環境

CentOS6.4標準バージョンのPython 2.6.6。pipのインストールまでをvagrantにsshでログインしてから。

% vagrant ssh
$ wget http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py
$ easy_install pip

nltk

nltkはPython.hを始めとしてpython-devel(CentOSだと)に依存しているので、事前にインストールする必要あり。

$ sudo yum install python-devel
$ sudo pip install -U numpy
$ sudo pip install -U pyyaml
$ sudo pip install -U nltk
コーパス

必要となるかはさておいて、ひとまずダウンロードall。数十分かかるので注意。

>>> import nltk
>>> nltk.download()
NLTK Downloader
---------------------------------------------------------------------------
    d) Download   l) List    u) Update   c) Config   h) Help   q) Quit
---------------------------------------------------------------------------
Downloader> 
Downloader> all

ひとまずこれで最低限の準備は整った。

+ (足す)から始めるIolanguage

本コンテンツの大部分は、末尾に記載させていただいたブログからの引用、インスパイヤです。ご了承下さい。

数学の世界で + は演算子である。5歳の子供でもそれを知っている。そして私やあなたが老いて死にゆくまで、+ は演算子でありそこに疑念の入る余地はない。

プログラミングの世界でもふつう + は演算子である。CでもJavaでもPerlでも + は演算子であり、それ以上でもそれ以下でもない。

ところが驚くべきことに、Iolanguageの世界では + は演算子*1ではないのである。

嘘だと思うなら、エディタを立ち上げて、次のようにしてみるといい。

Number + := method(v, (call target asSimpleString) .. (v asSimpleString))
1 + 2 # => 12
123 + 456 # => 123456

あなたは今、Number#+ メソッドを再定義した。そうしたら1 + 2は12という答えを返した。そう、Iolanguageの世界で + は演算子ではなく、ユーザが再定義可能なひとつのメッセージに過ぎないのだ。

私が知るかぎりIolanguageにシンタックスシュガーなんて存在しない。(極力シンタックスシュガーを用意しない方針だったはず。)

疑い深いあなたはこれだけでは納得しないかも知れない。そしてきっと、他の演算子についても試してみるのだろう。

Sequence multi := Sequence getSlot("*")
Sequence * := method(v,
  buffer := list()
  for(i, 1, v,
    buffer append(call target))
  buffer join)
Number plus := Number getSlot("+")
Number + := method(v,
  (call target asSimpleString) .. (v asSimpleString))
Number minus := Number getSlot("-")
Number - := method(v,
  res := call target minus(v)
  if(res > 0, res, "unknown world for me."))
Number div := Number getSlot("/")
Number / := method(v,
  str := call target asString(0) split(".") at(0)
  str split(v asString) size minus(1))
Number multi := Number getSlot("*")
Number * := method(rightv,
  leftv := call target asSimpleString
  strlen := leftv size
  if(strlen > rightv,
    leftv,
    emptysize := rightv minus(strlen)
    rest := emptysize % 2
    leftemptysize := emptysize div(2) floor plus(rest)
    rightemptysize := emptysize minus(leftemptysize)
    buffer := list()
    for (i, 1, leftemptysize,
      buffer append("*"))
    buffer append(leftv)
    for (i, 1, rightemptysize,
      buffer append("*"))
    buffer join))
Number doublemulti := Number getSlot("**")
Number ** := method(v,
  self * v * v)

1 + 2 # => 12
123 + 456 # => 123456
9 - 4 # => 5
21 - 34 # => "unknown world for me."
12345 * 20 # => "*******12345********"
3333456456 / 3 # => 4
3333456456 / 5 # => 2
12345 ** 7 # => "*12345**12345**12345**12345**12345**12345*"

納得した?

そうIolanguageの世界では + だけでなく、演算子のほとんどがメッセージ呼び出しなのである。

演算子をメッセージにする利点は2つある。1つは今見たようにそれが再定義可能であることだ。しかしより大きな利点は2つ目にある。

上で再定義した(ry

(...力尽き)

という...

という大部分が引用だった。後悔はしていない。反省はしている。
原文記事書いた方に怒られるかもしれないけど、真摯に受け止める。

以下、元記事。

*1:公式ドキュメント上はOperatorsとなっているが、

『Sencha Touchパーフェクトガイド』を献本頂きました

正式名称は、『HTML5モバイルアプリケーションフレームワーク Sencha Touchパーフェクトガイド」ですが長いので、省略しました。悪しからず。以下『Sencha Touchパーフェクトガイド』で。

表題の通り、Sencha Touchパーフェクトガイドをアスキー・メディアワークス様より献本頂きました。献本いただいんで書評をば。

筆頭であり「ラスボス」「番長」の二つ名を持つ@lirisさん並びに、著者の皆さんお疲れ様でした。

HTML5モバイルアプリケーションフレームワーク Sencha Touchパーフェクトガイド

HTML5モバイルアプリケーションフレームワーク Sencha Touchパーフェクトガイド

目次

  • 第1部 Sencha Touchの概要
    • 第1章 イントロダクション
    • 第2章 開発準備
    • 第3章 はじめてのSencha Touch
  • 第2部 Sencha Touchの基本構成
    • 第4章 クラスシステム
    • 第5章 コンポーネント
    • 第6章 イベントシステム
    • 第7章 データパッケージ
    • 第8章 リストとテンプレート
    • 第9章 アプリケーション
    • 第10章 Sencha Touchデザイン概論
    • 第11章 ネイティブパッケージング
  • 第3部 実践Sencha Touchアプリケーションの開発

各部/各章に一言づつ

第1部

第1部では、第1章でSencha Touchの概要、ExtJSの歴史から振り返るSencha Touch。

第2章では、実際に開発環境を整え、HelloWorldの表示。
第3章では、Sencha Touchのスケルトンコマンド(Sencha Cmdという事を知った)を使った後、Sencha TouchのMVC(モデル、ビュー、コントロール)を解説。

第2部

第4章では、Sencha Touch(ExtJs由来)のクラスシステムについての解説。
第5章では、GUI部品であるSencha Touchのコンポーネントを解説。viewportやUI部品のレイアウト、コンポーネントの検索クエリについて。
Sencha Touchで提供されている標準GUI部品については巻末の付録に記載されているのでそちらを見ると吉。

第6章では、イベントシステムについて。イベントターゲットへのイベントリスナの登録、削除、リスナ登録時のオプション。そして、ユーザー定義の独自イベントの定義と発火について。

第7章では、MVCのM(=モデル)に関係してExt.dataパッケージについて。基本的なモデルのフィールド定義をはじめ、モデル間のリレーション定義。そしてモデルとプロキシ、ストアのそれぞれの役割。ストアの中に入っているモデルのフィルタリング、ソート。プロキシという抽象的なデータを扱う概念とAjaxやデータストレージなどの具体的な機構について。

第8章では、GUI部品のExt.dataview.Listと定義したモデルを使って動かしてみる。Sencha Touchのテンプレートエンジンも。

第9章では、MVCのコントローラに主眼をおいてます。最大の目玉はルーティング。また、各プラットフォーム(デバイス)ごとに最適なビュー、コントローラの切り替えを実行時に行うプロファイラについて解説。

第10章では、Sencha Touchデザイン概論ということで、Sass、Compassを使ってCSSの生成を学び実際にSencha Touchのデザインを変更を試みる。

第11章では、Sencha Touchアプリケーションを配布形式に変換するパッケージングの章です。驚くことに、Sencha TouchはAndroid、iOSに対するShellApp(webviewをネイティブで包むアプリ)をサポートしています。
ごく少数だけどネイティブAPIも対応しています。

第3部

第12章から第15章は第1部、第2部の基本知識を元にして、家計簿アプリケーションを作成します。

14章では、カスターコンポーネントを作成します。
15章では、Sencha touch Chartsを使って描画に関して学ぶことができます。

My Memo

第2章でサクッとnginxをインストールし開発環境を構築するところはpython -m SimpleHTTPServer 3333とかでもよかったのでは?と一瞬思うが、nginxがそれだけ身近になったのだなぁ。と思いました。

第4章のP59、console.logで%sを使えることを初めて知る...。コンフィグの仕組みによってsetter/getterが自動生成されるのはExtJsグッジョブです!

第7章で"JsonP"、"Rest"と文字の大文字小文字が気になった。JSONP、RESTではないのか...。

第10章でSassクライアントであるCompass.appやLiveReload2、CodeKitが紹介されていたのだけど、GUIアプリがあるの知らなかったです。ふむふむ。

第11章でShellAppをサポートしているのを知ったのだけど、Apache cordova(旧Phonegap)以外の手段として良さそう。

追伸

@kawanoshinobuさん、次はClosureシリーズについての書籍楽しみにしています(・∀・)ニヤニヤ

My memo2

  • 巻末に載ってた『Monoプログラミング』とかそそられる表紙だった...。

Monoプログラミング .NET/C#とMono for AndroidによるAndroidアプリケーション開発

Monoプログラミング .NET/C#とMono for AndroidによるAndroidアプリケーション開発

  • Land of Lispが後回しになってしまってるので、再開しないと。

Land of Lisp

Land of Lisp

    • といいつつ、パーフェクトPythonも購入してしまった...。消化量を上回る購入量。

パーフェクトPython (PERFECT SERIES 5)

パーフェクトPython (PERFECT SERIES 5)

書籍"Land of Lisp"5章5.1, 5.2 by used of Iolanguage

5.2の途中だけど例のごとくIolanguageで。

5章5.1, 5.2

Object curlyBrackets := method(
  map := Map clone;
  call message arguments foreach(arg, arg setName("atPut"); map doMessage(arg));
  map;
)

Object squareBrackets := method(
  list := List clone;
  call message arguments foreach(arg, list append(arg));
  list
)

nodes := {
  living_room := "you are in the living-room. a wizard is snoring loudly on the couch.",
  garden      := "you are in a beautiful garden. there is a well in front of you.",
  attic       := "you are in the attic. there is a giant welding torch in the corner."
}
//nodes := Map clone
//nodes atPut("living_room", "you are in the living-room. a wizard is snoring loudly on the couch.")
//nodes atPut("garden", "you are in a beautiful garden. there is a well in front of you.")
//nodes atPut("attic", "you are in the attic. there is a giant welding torch in the corner.")

assoc := method(key, items, items at(key))
describe_location := method(key, items, assoc(key, items))

//describe_location("garden", nodes) println
edges := {
  living_room := [
    ["garden", "west", "door"],
    ["attic", "upstairs", "ladder"]
  ],
  garden := [
    ["living_room", "east", "door"]
  ],
  attic := [
    ["living_room", "downstairs", "ladder"]
  ]
}

car := method(list, list at(0))
cdr := method(list, list exSlice(1, list size))

cadr := method(list, car(cdr(list)))
cddr := method(list, cdr(cdr(list)))
caddr := method(list, car(cddr(list)))

describe_path := method(edge, "there is a " .. caddr(edge) .. " going " .. cadr(edge) .. " from here.")

describe_path([garden, west, door]) println

所感

JSでいうところのリテラルの配列やオブジェクトがIolanguageではないから、curlyBrackets, squareBracketsとMap, Listを駆使して定義しないといけなかった。
carやcdrの定義も結構適当。

書籍

Land of Lisp

Land of Lisp