Top Banner
What the Hack?!
44

What the Hack?!

Feb 13, 2017

Download

Software

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: What the Hack?!

What the Hack?!

Page 2: What the Hack?!

Uszanowanko!

Maciej Mączko, programista PHP.

Page 3: What the Hack?!

Facebook- 2004 - ???- Drugi największy serwis świata (według Alexa) (Ten spamowy toolbar z IE)

Page 4: What the Hack?!
Page 5: What the Hack?!
Page 6: What the Hack?!

Facebook- 2004 - ???- Drugi największy serwis świata (według Alexa) (Ten spamowy toolbar z IE)- 1.49 mld unikalnych użytkowników w ciągu miesiąca (578 unikalnych w ciągu sekundy)- +500 TB dziennie

(http://newsroom.fb.com/company-info/)

Page 7: What the Hack?!

Facebook- Własna implementacja stosu TCP/IP- Deployment oparty na Bittorrent- 10 955 pracowników (czerwiec 2015)- Centra danych: Altoona, Forest City, Lulea, Prineville, Ashburn- Centrala: 1 Hacker Way, Menlo Park, California 94025

Page 8: What the Hack?!

HPHPc- (Hip Hop for PHP)- 2010 - 2012- Konieczność rekompilacji całego środowiska- Brak maszyn testowych- PHP 5.2 (64 bit)- Brak eval() i innych.

Page 9: What the Hack?!

HPHPi- Interpreter- 2010 - 2012- Niezgodność z HPHPc- Niska wydajność

Page 10: What the Hack?!

HipHop VM (HHVM)- 2013 - ???- (HPHPc + HPHPi)- JIT! JIT! JIT!- 2x-6x szybsze od PHP 5.2- Kompatybilność z PHP 5.6- 25 największych projektów z Github odpala się bez problemów

Page 11: What the Hack?!

HipHop VM (HHVM)- Baidu, Wikipedia, Facebook, Etsy, The Software House - 3 z 10 największych witryn korzysta z HHVM- Facebook ma 1 GB kodu źródłowego.

Page 12: What the Hack?!

Hack- Funkcje asynchroniczne- Kolekcje- Awans parametrów formalnych konstruktora (Constructor Argument Promotion)- Typy generyczne

Page 13: What the Hack?!

Hack- Tryby: Strict, Partial, Decl- Nullable- Krotki (tuples)- Typowanie- Generatory (przed PHP :P)

Page 14: What the Hack?!

Hack (niewspierane)- Top level code- Kolizje nazw (metoda nazwana jak klasa)- Goto (nikt nie zauważył ;-) )- And, Or, Xor (wymagane: &&, ||, ^) - Break n, continue n- Globale

Page 15: What the Hack?!

Hack (niewspierane)- Podwójna dereferencja zmiennych ($$a)- Eval- Case-insensitive function calls- Mieszanie HTML i Hacka

Page 16: What the Hack?!

Funkcje asynchroniczne

Page 17: What the Hack?!

Kolekcje (Vector)

Page 18: What the Hack?!

Kolekcje (Map)

Page 19: What the Hack?!

Kolekcje (Set)

Page 20: What the Hack?!

Kolekcje (Pair)

Page 21: What the Hack?!

Zmiany w tablicach

Page 22: What the Hack?!

Kolekcje niezmienne- ImmVector- ImmMap- ImmSet

Page 23: What the Hack?!

Przeniesione z PHP:- array_combine- array_diff- array_keys- count- implode- explode- serialize- var_dump <3

- sortowania…- i wiele innych

Page 24: What the Hack?!

Ograniczenia kolekcji- Nie można pobrać referencji do elementu kolekcji- <, >, <=, >= nie zostały jeszcze zaimplementowane.

Page 25: What the Hack?!

Awans parametrów formalnych konstruktora

Page 26: What the Hack?!

Awans parametrów formalnych konstruktora

Page 27: What the Hack?!

Nullable

Page 28: What the Hack?!

Krotki (tuple)- aka tablice o stałym rozmiarze.

Page 29: What the Hack?!

Typy generyczne

Page 30: What the Hack?!

Typowanie

Page 31: What the Hack?!

Hack mode (strict)- Każdy bład typowania jest błedem- Cały kod musi być typowany- Nie można odpalać nieHackowego kodu- Brak top-level code

Page 32: What the Hack?!

Hack mode (partial)- Tryb domyślny- Może być otypowany- Może nie być otypowany- Każdy bład typowania jest błedem

Page 33: What the Hack?!

Hack mode (decl)- Może być otypowany- Może nie być otypowany- Każdy bład typowania NIE jest błedem- Może być odpalany przez strict code

Page 34: What the Hack?!

Pozostałe informacje- Moduły do Hacka mogą być pisane w PHP.- ^-- A więc da się zrobić framework jako moduł Hacka.- Gradual typing- HHVM - threaded

Page 35: What the Hack?!

Jak zacząć?

Page 36: What the Hack?!

Jak odpalić type checkera?

Page 37: What the Hack?!

I co dalej…?

Page 38: What the Hack?!

Hackificator

Page 39: What the Hack?!

hh_server

Page 40: What the Hack?!

Wordpress?

Page 41: What the Hack?!

Slim?

Page 42: What the Hack?!

Phpmyadmin? :(

Page 43: What the Hack?!

Phpmyadmin? :(

Page 44: What the Hack?!