2010년 10월 26일 화요일

앱스토어 등록하고 소스코드를 공개한 앱


http://maniacdev.com/2010/06/35-open-source-iphone-app-store-apps-updated-with-10-new-apps/

1. ABC 123 – Sequence memorization game. Utilizes Cocos2D. (itunes link) (source code)

*2. Artifice – Strategy game where you try to get to the other side by moving boxes out of the way. Utilizes Cocos2D. (itunes link) (source code)

3. Colloquy – Conversion of the most popular Mac IRC client to the iPhone. (itunes link) (source code)

*4. Countitout - A generic counting app. (itunes link) (source code)

5. Diceshaker - Dice rolling simulator designed for role-playing game enthusiasts. (itunes link) (source code)

6. Doom Classic - Classic 3D first person shooter. (itunes link) (source code) (build instructions)

*7. Ecological Footprint - Calculate, display, and record your ecological footprint. (itunes link) (source code)

8. Fosdem - Calendar app for the Fosdem open source conference. (itunes link) (source code)

9. Freshbooks – App that enables usage of Freshbooks web invoicing software from your iPhone. (itunes link) (source code)

10. Gorillas – Classic Worms/iShoot turn based shooter type game converted to iPhone from basic. Utilizes Cocos2D. (itunes link) (source code). 1249ouFh83XA

11. Go Go Lotto – Open source lotto ticket generator. (itunes link) (source code)

12. iStrobe - Turns the iPhone 4 flash into a highly configurable strobe light. (itunes link) (source code)

13. Last.fm – Software that enables usage of the Last.fm platform for personal radio stations. (itunes link) (source code)

14. Mobilesynth - A monophonic synthesizer designed for live performance. (itunes link) (source code)

15. Molecules – Allows you to view 3D models of molecules and manipulate them through touch. (itunes link) (source code)

16. Mover – Allows you to transfer stuff from one iPhone to another by “flicking” it to the other device. (itunes link) (source code)

17. Natsulion - A basic twitter client converted from mac. (itunes link) (source code)

18. NowPlaying – Allows you to check local theater listings, and check rotten tomato ratings. (itunes link) (source code)

19. Packlog – Backpack journal client. (itunes link) (source code)

20. PlainNote - Simple Open Source Notepad. (itunes link) (source code)

21. PocketFlix – Find movies, and manage your Netflix information. (itunes link) (source code)

22. NevoChess – A Xiangqi game. (itunes link) (source code)

23. reMail – E-mail client featuring ultra-fast search. Removed from app store, but source made available. (source code)

24. RobotFindsKitten – Port of a very silly “classic” ASCII game. (itunes link) (source code)

25. Sci-15 HPCalc – Calculator app based on classic scientific HP-Calculator. (itunes link) (source code)

26. SpaceBubble – Space game featuring core graphics, and accelerometer usage. (itunes link) (source code)

27. Star3Map – Augmented reality star and planet charting application. (itunes link) (source code)

28. Task Coach – Personal to-do list and task manager. (itunes link) (source code)

29. Tubestatus – London train schedule tracker. (itunes link) (source code)

30. Tweejump – Platform jumping game inspired by Icy Tower. Utilizes Cocos2D. (itunes link) (source code)

31. Tweetee – Enhanced version of the Natsulion Twitter Client. (itunes link) (source code)

32. Tweetero – Basic twitter client with image uploading. (itunes link) (source code)

33. Twitterfon – Super-fast intuitive twitter client. (itunes link) (source code)

34. ViralFire – Unique game where you are a dodging blood cell. (itunes link) (source code)

35. Wikihow – A reader app for the popular how to wiki site. (itunes link) (source code)

36. Wolfenstein 3D Classic Platinum – If you haven’t heard of Wolfenstein post below so we can say a prayer for you. (itunes link) (source code)

37. WordPress – Client for managing WordPress blogs. Also has an iPad version. (itunes link) (source code)

38. YourRights – Pocket database containing a summary of your legal rights. (itunes link) (source code)

39. ZBar – A barcode reader. (itunes link) (source code)

오픈소스 블로그 사이트


2010년 10월 25일 월요일

tracemonkey, javascript JIT compiler & google v8

파이어폭스 3.1에 TraceMonkey라는게 도입된다구 합니다. 이게- 자바스크립트를 엄청 빠르게 해준다는데...

파이어폭스에 들어있는 자바스크립트 엔진이 Spider Monkey라는 이름을 갖고 있는데요, Trace Monkey가 이걸 대체한다는건지, 이 기술이 추가가 된다는 건지는 잘 모르겠습니다.

암튼 trace monkey는 자바스크립트 JIT(just in time) 컴파일러 역할을 하는 모양입니다. js는 대개 인터프리터 방식으로 동작하는데다 동적이기도 하고 .. 해서 속도가 그다지 빠른 편은 아닌걸로 압니다. 그런데 Ajax가 대 히트를 치면서, 그리고 "웹페이지"가 아닌 "웹애플리케이션"으로 진화하면서 js사용이 엄청 많아진 요즘, js가 웹서비스에서 병목이 되는 경우도 많지요.

firefox 2.0에서 gmail을 띄워놓고 하룻밤쯤 지나면 메모리 점유가 엄청나고, 브라우저가 먹통이 될 정도로 느려지기도 했었지요. firefox 3.0에 와서 이래저래 많이 빨라지기는 했지만 오늘 구글 크롬을 설치해보니 ㅎㅎ 비교가 안 되더군요.

구글 크롬Chrome 얘기가 나와서 말인데, (구글에서 만든 웹브라우저입니다) 여기에 쓰여진 자바스크립트 VM(엔진이 아니라 VM;Virtual Machine이란 표현을 주로 쓰더군요)은 V8이라는 이름을 가졌어요. 이 v8의 특징을 보니 js를 'native machine code'로 바꿔 실행한다고 하네요.

결국 trace monkey나 v8이나 비슷한 방식이 아닌가 하는 생각을 해 봅니다. 그리고 브라우저 개발의 초점은 js 성능향상이구나. 라는 생각도...

firefox3나 사파리 브라우저를 보면서, 와 되게 빨라졌네! 라고 생각했는데. 크롬이라던가 최근의 경향을 보니까 '빠른 것도 더 빨라질 수 있다'군요. 이쯤 되면 js를 더 전문적으로 해보는 것도 좋겠다는 생각도 들고요. 더 발전해서 server-side를 js로 개발하는 날이 왔으면 좋겠다는 생각도 해봅니다 ㅎㅎ

이상은 저의 추측입니다만, 혹시 잘못된 점이 있으면 지적해주세요.

Just-in-time compilation

Just-in-time compilation

From Wikipedia, the free encyclopedia

In computing, just-in-time compilation (JIT), also known as dynamic translation, is a method to improve the runtime performance of computer programs. Traditionally, computer programs had two modes of runtime operation, either interpreted or static (ahead-of-time) compilation.[citation needed] Interpreted code is translated from a high-level language to a machine code continuously during every execution, whereas statically compiled code is translated into machine code before execution, and only requires this translation once.

JIT compilers represent a hybrid approach, with translation occurring continuously, as with interpreters, but with caching of translated code to minimize performance degradation. It also offers other advantages over statically compiled code at development time, such as handling of late-bound data types and the ability to enforce security guarantees.

JIT builds upon two earlier ideas in run-time environments: bytecode compilation and dynamic compilation. It converts code at runtime prior to executing it natively, for example bytecode into native machine code.

Several modern runtime environments, such as Microsoft's .NET Framework and most implementations of Java, rely on JIT compilation for high-speed code execution.

Contents

[hide]

[edit]Overview

In a bytecode-compiled system, source code is translated to an intermediate representation known as bytecode. Bytecode is not the machine code for any particular computer, and may be portable among computer architectures. The bytecode may then be interpreted by, or run on, a virtual machine. A just-in-time compiler can be used as a way to speed up execution of bytecode. At the time the bytecode is run, the just-in-time compiler will compile some or all of it to native machine code for better performance. This can be done per-file, per-function or even on any arbitrary code fragment; the code can be compiled when it is about to be executed (hence the name "just-in-time").

In contrast, a traditional interpreted virtual machine will simply interpret the bytecode, generally with much lower performance. Some interpreters even interpret source code, without the step of first compiling to bytecode, with even worse performance. Statically compiled code or native code is compiled prior to deployment. A dynamic compilation environment is one in which the compiler can be used during execution. For instance, most Common Lisp systems have a compile function which can compile new functions created during the run. This provides many of the advantages of JIT, but the programmer, rather than the runtime, is in control of what parts of the code are compiled. This can also compile dynamically generated code, which can, in many scenarios, provide substantial performance advantages over statically compiled code, as well as over most JIT systems.

A common goal of using JIT techniques is to reach or surpass the performance of static compilation, while maintaining the advantages of bytecode interpretation: Much of the "heavy lifting" of parsing the original source code and performing basic optimization is often handled at compile time, prior to deployment: compilation from bytecode to machine code is much faster than compiling from source. The deployed bytecode is portable, unlike native code. Since the runtime has control over the compilation, like interpreted bytecode, it can run in a secure sandbox. Compilers from bytecode to machine code are easier to write, because the portable bytecode compiler has already done much of the work.

JIT code generally offers far better performance than interpreters. In addition, it can in some cases offer better performance than static compilation, as many optimizations are only feasible at run-time:

  1. The compilation can be optimized to the targeted CPU and the operating system model where the application runs. For example JIT can choose SSE2 CPU instructions when it detects that the CPU supports them. To obtain this level of optimization specificity with a static compiler, one must either compile a binary for each intended platform/architecture, or else include multiple versions of portions of the code within a single binary.
  2. The system is able to collect statistics about how the program is actually running in the environment it is in, and it can rearrange and recompile for optimum performance. However, some static compilers can also take profile information as input.
  3. The system can do global code optimizations (e.g. inlining of library functions) without losing the advantages of dynamic linking and without the overheads inherent to static compilers and linkers. Specifically, when doing global inline substitutions, a static compiler must insert run-time checks and ensure that a virtual call would occur if the actual class of the object overrides the inlined method (however, this need not be the case for languages employing a static type discipline).
  4. Although this is possible with statically compiled garbage collected languages, a bytecode system can more easily rearrange memory for better cache utilization.

[edit]Startup delay and optimizations

JIT typically causes a slight delay in initial execution of an application, due to the time taken to load and compile the bytecode. Sometimes this delay is called "startup time delay". In general, the more optimization JIT performs, the better the code it will generate, but the initial delay will also increase. A JIT compiler therefore has to make a trade-off between the compilation time and the quality of the code it hopes to generate. However, it seems that much of the startup time is sometimes due to IO-bound operations rather than JIT compilation (for example, the rt.jar class data file for the Java Virtual Machine is 40 MB and the JVM must seek a lot of data in this huge file).[1]

One possible optimization, used by Sun's HotSpot Java Virtual Machine, is to combine interpretation and JIT compilation. The application code is initially interpreted, but the JVM monitors which sequences of bytecode are frequently executed and translates them to machine code for direct execution on the hardware. For bytecode which is executed only a few times, this saves the compilation time and reduces the initial latency; for frequently executed bytecode, JIT compilation is used to run at high speed, after an initial phase of slow interpretation. Additionally, since a program spends most time executing a minority of its code, the reduced compilation time is significant. Finally, during the initial code interpretation, execution statistics can be collected before compilation, which helps to perform better optimization.[2]

The correct tradeoff can vary due to circumstances. For example, Sun's Java Virtual Machine has two major modes—client and server. In client mode, minimal compilation and optimization is performed, to reduce startup time. In server mode, extensive compilation and optimization is performed, to maximize performance once the application is running by sacrificing startup time. Other Java just-in-time compilers have used a runtime measurement of the number of times a method has executed combined with the bytecode size of a method as a heuristic to decide when to compile.[3] Still another uses the number of times executed combined with the detection of loops.[4] In general, it is much harder to accurately predict which methods to optimize in short-running applications than in long-running ones.[5]

Native Image Generator (Ngen) by Microsoft is another approach at reducing the initial delay.[6] Ngen pre-compiles (or "pre-jits") bytecode in a Common Intermediate Language image into machine native code. As a result, no runtime compilation is needed. .NET framework 2.0 shipped with Visual Studio 2005 runs Ngen on all of the Microsoft library DLLs right after the installation. Pre-jitting provides a way to improve the startup time. However, the quality of code it generates might not be as good as the one that is jitted, for the same reasons why code compiled statically, without profile-guided optimization, cannot be as good as JIT compiled code in the extreme case: the lack of profiling data to drive, for instance, inline caching.[7]

There also exist Java implementations that combine an AOT (ahead-of-time) compiler with either a JIT compiler (Excelsior JET) or interpreter (GNU Compiler for Java.)

[edit]History

The earliest published JIT compiler is generally attributed to work on LISP by McCarthy in 1960.[8] In his seminal paper Recursive functions of symbolic expressions and their computation by machine, Part I, he mentions functions that are translated during runtime, thereby sparing the need to save the compiler output to punch cards.[9] In 1968, Thompson presented a method to automatically compile regular expressions to machine code, which is then executed in order to perform the matching on an input text.[10][8] An influential technique for deriving compiled code from interpretation was pioneered by Mitchell in 1970, which he implemented for the experimental languageLC².[11][8]

Smalltalk pioneered new aspects of JIT compilations. For example, translation to machine code was done on demand, and the result was cached for later use. When memory became sparse, the system would delete some of this code and regenerate it when it was needed again.[12][8] Sun's Self language improved these techniques extensively and was at one point the fastest Smalltalk system in the world; achieving up to half the speed of optimized C[13] but with a fully object-oriented language.

Self was abandoned by Sun, but the research went into the Java language, and currently it is used by most implementations of the Java Virtual Machine, as HotSpotbuilds on, and extensively uses, this research base.

The HP project Dynamo was an experimental JIT compiler where the bytecode format and the machine code format were of the same type; the system turned HPA-8000 bytecode into HPA-8000 machine code. Counterintuitively, this resulted in speed ups, in some cases of 30% since doing this permitted optimizations at the machine code level, for example, inlining code for better cache usage and optimizations of calls to dynamic libraries and many other run-time optimizations which conventional compilers are not able to attempt.[14]

[edit]See also

[edit]References

  1. ^ Haase, Chet (May 2007). "Consumer JRE: Leaner, Meaner Java Technology". Sun Microsystems. Retrieved 2007-07-27. "At the OS level, all of these megabytes have to be read from disk, which is a very slow operation. Actually, it's the seek time of the disk that's the killer; reading large files sequentially is relatively fast, but seeking the bits that we actually need is not. So even though we only need a small fraction of the data in these large files for any particular application, the fact that we're seeking all over within the files means that there is plenty of disk activity. "
  2. ^ The Java HotSpot Performance Engine Architecture
  3. ^ Schilling, Jonathan L. (February 2003). "The simplest heuristics may be the best in Java JIT compilers". SIGPLAN Notices 38 (2): 36–46. doi:10.1145/772970.772975.
  4. ^ Toshio Suganuma, Toshiaki Yasue, Motohiro Kawahito, Hideaki Komatsu, Toshio Nakatani, "A dynamic optimization framework for a Java just-in-time compiler",Proceedings of the 16th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications (OOPSLA '01), pp. 180-195, October 14–18, 2001.
  5. ^ Matthew Arnold, Michael Hind, Barbara G. Ryder, "An Empirical Study of Selective Optimization", Proceedings of the 13th International Workshop on Languages and Compilers for Parallel Computing-Revised Papers, pp. 49-67, August 10–12, 2000.
  6. ^ http://msdn2.microsoft.com/en-us/library/6t9t5wcf(VS.80).aspx
  7. ^ Matthew R. Arnold, Stephen Fink, David P. Grove, Michael Hind, and Peter F. Sweeney, "A Survey of Adaptive Optimization in Virtual Machines", Proceedings of the IEEE, 92(2), February 2005, pp. 449-466.
  8. ^ a b c d Aycock, J. (June 2003). "A brief history of just-in-time". ACM Computing Surveys 35 (2): 97–113. doi:10.1145/857076.857077. Retrieved 2010-05-24.
  9. ^ McCarthy, J. (April 1960). "Recursive functions of symbolic expressions and their computation by machine, Part I". Communications of the ACM 3 (4): 184–195.doi:10.1145/367177.367199. Retrieved 24 May 2010.
  10. ^ Thompson, K. (June 1968). "Programming Techniques: Regular expression search algorithm". Communications of the ACM 11 (6): 419–422.doi:10.1145/363347.363387. Retrieved 2010-05-24.
  11. ^ Mitchell, J.G. (1970), The design and construction of flexible and efficient interactive programming systems
  12. ^ Deutsch, L.P.; Schiffman, A.M. (1984), "Efficient implementation of the Smalltalk-80 system", POPL '84: Proceedings of the 11th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages: 297–302, doi:10.1145/800017.800542
  13. ^ http://research.sun.com/jtech/pubs/97-pep.ps
  14. ^ Ars Technica on HP's Dynamo