wordpress on hhvm + hack

Post on 13-Aug-2015

1.310 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

WordPress onHHVM + Hack

WordCamp Kansai 2015 Takayuki Miyauchi

自己紹介

My WordPress Plugins

vccw.cc

DigitalCube Inc. en.digitalcube.jp

AWS Advanced Consulting Partner

Facebook社が開発した PHP及びHack言語の実行環境

Hack言語?

http://hacklang.org/

<?php

<?hh

静的型付言語

<?hh

function my_func( int $a ): int { return $a + 1; }

my_func( 'hoge' ); // Fatal Error my_func( '10' ); // Fatal Error my_func( 10 ); // OK

<?hh

function my_func( int $a ): int { return 'Hello'; // Fatal Error }

PHPと互換性あり

PHPからrequire()が可能

WordPressプラグインで 利用可能!

<?php /* Plugin Name: Hack WP */

if ( is_hhvm() ) { require_once( dirname( __FILE__ ) . '/lib/hhwp.hh' ); add_filter( 'the_content', 'hoge' ); }

function is_hhvm() { return preg_match( "/\-hhvm$/", phpversion() ); }

<?hh

function hoge( string $content ) : string { // do something

return $content; }

非同期処理

ロード時間

非同期で実行すれば大幅なパフォーマンスアップ

<?hh

async function hello(): Awaitable<string> { // do something return "Hello World"; }

$a = hello(); $a->getWaitHandle()->join(); // Hello World

Thanks!

top related