python vs java @ pycon korea 2017

Download Python vs Java @ PyCon Korea 2017

Post on 21-Jan-2018

4.586 views

Category:

Software

0 download

Embed Size (px)

TRANSCRIPT

  1. 1.
  2. 2. () & () SDS / () () S/W (2004) (Chris Cho)
  3. 3. List of Contents
  4. 4. PyData at Strata
  5. 5. Pythons Spectrum of Users
  6. 6. Type of language Python Source Code (.py) Interpreter Java Source Code (.java) Java Compiler Bytecode (.class) Bytecode Interpreter
  7. 7. How can I run? print("Hello, World!!") PYTHON
  8. 8. How can I run? print("Hello, World!!") PYTHON
  9. 9. How can I run? print("Hello, World!!") PYTHON !!
  10. 10. How can I run? public class Hello { public static void main (String[] args) { System.out.println("Hello, World!!"); } } print("Hello, World!!") PYTHON
  11. 11. How can I run? public class Hello { public static void main (String[] args) { System.out.println("Hello, World!!"); } } print("Hello, World!!") PYTHON
  12. 12. How can I run? public class Hello { public static void main (String[] args) { System.out.println("Hello, World!!"); } } print("Hello, World!!") PYTHON
  13. 13. How can I run? public class Hello { public static void main (String[] args) { System.out.println("Hello, World!!"); } } print("Hello, World!!") PYTHON
  14. 14. How can I run? public class Hello { public static void main (String[] args) { System.out.println("Hello, World!!"); } } print("Hello, World!!") PYTHON
  15. 15. How can I run? public class Hello { public static void main (String[] args) { System.out.println("Hello, World!!"); } } print("Hello, World!!") PYTHON
  16. 16. Hello, World!! print("Hello, World!!") public class Hello { public static void main (String[] args) { System.out.println("Hello, World!!"); } }
  17. 17. Hello, World!! - Python print("Hello, World!!")
  18. 18. Hello, World!! - Python print("Hello, World!!")
  19. 19. Hello, World!! - Java public class Hello { public static void main (String[] args) { System.out.println("Hello, World!!"); } }
  20. 20. Hello, World!! - Java public class Hello { public static void main (String[] args) { System.out.println("Hello, World!!"); } } . Main /
  21. 21. split() text = "I love Python Programming" for word in text.split(): print(word) public class SplitText { public static void main (String[] args) { String text = "I love Python Programming"; for (String word: text.split(" ")) System.out.println(word); } }
  22. 22. split() - Python text = "I love Python Programming" for word in text.split(): print(word) text ( )
  23. 23. split() - Java public class SplitText { public static void main (String[] args) { String text = "I love Python Programming"; for (String word: text.split(" ")) System.out.println(word); } } ( ) ( ) text
  24. 24. join() and range() "-".join(str(n) for n in range(100)) private static void join (int num) { for(int i = 0; i < num; i++) { StringBuilder sb = new StringBuilder(); for(int j: IntStream.range(0, 100).toArray()) { if(sb.length() == 0) sb.append(j); else sb.append("-").append(j); } } }
  25. 25. join() and range() - Python "-".join(str(n) for n in range(100)) 0 ~ 99 - (0-1-2-3-4 -97-98-99) ( ) Comprehension 0~99
  26. 26. join() and range() - Java private static void join (int num) { for(int i = 0; i < num; i++) { StringBuilder sb = new StringBuilder(); for(int j: IntStream.range(0, 100).toArray()) { if(sb.length() == 0) sb.append(j); else sb.append("-").append(j); } } } Custom Helper 0 ~ 99 - (0-1-2-3-4 -97-98-99) 0~99
  27. 27. Run Time Comparison code = '"-".join(str(n) for n in range(100))' print(timeit.timeit(code, number=10000)) public class JoinTest { public static void main (String[] args) { long start = System.nanoTime(); join(10000); long elapsed = System.nanoTime() - start; System.out.println(elapsed / 1000000000.0); } }
  28. 28. Run Time Comparison 0.323 0.198 (IntStream.range()) 0.086 (Traditional Loop) x 1.6 x 2.3 x 3.8
  29. 29. Run Time Comparison 0.323 0.198 0.086 (Traditional Loop) x 1.6 x 2.3 x 3.8 0.323 secSLOW? or ENOUGH?
  30. 30. Development Time Comparison Python Source Code (.py) Interpreter Java Source Code (.java) Java Compiler Bytecode (.class) Bytecode Interpreter
  31. 31. Development Time Comparison Python Source Code (.py) Interpreter Java Source Code (.java) Java Compiler Bytecode (.class) Bytecode Interpreter
  32. 32. Development Time Comparison Python Source Code (.py) Interpreter Java Source Code (.java) Java Compiler Bytecode (.class) Bytecode Interpreter
  33. 33. Conclusion Free-Style High-end
  34. 34. Conclusion Same Size
  35. 35. Conclusion Different Size
  36. 36. Conclusion Easier For wide usage Difficult For Race Different Size
  37. 37. Conclusion Build FAST VS Run FAST
  38. 38. Conclusion Build FAST VS Run FAST
  39. 39. E-mail : isi.cho@gmail.com Facebook : https://www.facebook.com/insuk.chris.cho Brunch : https://www.brunch.co.kr/@insuk Python Programming : https://www.facebook.com/pythonmento PyData Korea : https://www.facebook.com/groups/pydatakorea/