ทดสอบความแรง PHP7 Dev
12:03 AM
0 Comments
hhvm
,
php performance
,
php-7
,
php7
ลองนั่งทดสอบความแรงของ php 7 มาครับ แรงขึ้นเยอะจริงๆ โดยผมได้ลองรัน script นี้12:03 AM 0 Comments hhvm , php performance , php-7 , php7
https://gist.github.com/kittinan/3173c58b32b8e7739b11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php
/*
* Largest palindrome product
*/
$max = 0;
$output = null;
for ($i = 100; $i < 10000; $i++ ) {
for ($j = 100; $j < 10000; $j++) {
$mul = $i*$j;
if ($mul == strrev($mul) && $mul > $max) {
$max = $mul;
}
}
}
echo "$max\n";
กับ PHP 7 dev, PHP 5.5.9 และ HHVM 3.61 ผลปรากฎว่า
HHVM ใช้เวลาประมาณ 11 วิ
PHP 7 ใช้เวลาประมาณ 16 วิ
PHP 5.5.9 ใช้เวลาประมาณ 1 นาที กว่า O_O
วิธีการเชื่อมต่อ Github กับ Scrutinizer-CI
Saturday, March 7, 2015
10:49 PM
0 Comments
code coverage
,
code quality
,
git
,
github
,
php
,
scrutinizer-ci
,
travis-ci
ต่อจากบทความ วิธีการเชื่อมต่อ Github กับ Travis-CI บทความนี้ก็จะมาเล่าเกี่ยวกับวิธีการเชื่อมต่อ Github กับ Scrutinizer-CI เพื่อที่ Build & Test และจะได้มี Badge สำหรับ Code Coverage กับ Code Quality สวยๆมาแปะครับSaturday, March 7, 2015 10:49 PM 0 Comments code coverage , code quality , git , github , php , scrutinizer-ci , travis-ci
1. เข้าไปที่ Website https://scrutinizer-ci.com แล้วทำการ Login ด้วย Github
2. เมื่อ Login เรียบร้อยแล้วให้สร้าง Repository https://scrutinizer-ci.com/g/new
3. ใส่ URL Github Project ของเราที่ต้องการใช้งาน (ในที่นี่ใช้ Project นี้ https://github.com/kittinan/php-http) ดังภาพ
4. สร้างไฟล์สำหรับ Build Configuration เจ้า Scrutinizer-CI โดยใช้ชื่อว่า .scrutinizer.yml ที่ root path ของ Project และใส่ code ดังนี้ https://gist.github.com/kittinan/6baf4dd0961e18dc7812
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter:
excluded_paths: [tests/*]
checks:
php:
code_rating: true
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true
tools:
external_code_coverage:
timeout: 1200
runs: 3
php_analyzer: true
php_code_coverage: false
php_code_sniffer:
config:
standard: PSR2
filter:
paths: ['src']
php_cpd:
enabled: true
excluded_dirs: [vendor, tests]
php_loc:
enabled: true
excluded_dirs: [vendor, tests]
php_pdepend: true
php_sim: true
สามารถดูรายละเอียดเพิ่มเติมสำหรับ Build Configuration ได้ที่ https://scrutinizer-ci.com/docs/configuration/build
5. แก้ไขไฟล์ .travis.yml เพื่อให้ Travis-CI อัพโหลด Code Coverage ไปที่ Scrutinizer-CI ดังนี้
https://gist.github.com/kittinan/124d539cd6fbf7c5e8d5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: php
php:
- 5.5
- 5.4
- 5.3
- hhvm
before_script:
- wget http://getcomposer.org/composer.phar
- php composer.phar install --dev --no-interaction
script:
- phpunit ./tests
- mkdir -p build/logs
- phpunit --coverage-clover build/logs/clover.xml ./tests
after_script:
- php vendor/bin/coveralls -v
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
5. Push file .scrutinizer.yml และ .travis.yml ขึ้น Github
6. สั่ง Run your first inspection ที่ Scrutinizer-CI แล้วรอสักพักใหญ่
7. เมื่อ Scrutinizer-CI ประมวลผลเสร็จเรียบร้อยก็จะพบกับ Code Quality และ Code Coverage ดังภาพ
8. เราก็สามารถนำ Badge Code Quality และ Code Coverage เท่ๆมาแปะที่ Github Project ของเราได้แล้วครับ https://github.com/kittinan/php-http
0 comments: