TruffleRuby 시도
4278 단어 rubytruffleruby
# encoding: UTF-8
require 'thailang4r/word_breaker'
word_breaker = ThaiLang::WordBreaker.new
line = 'แต่ผมเคยมีปัญหาตอนจ่ายตังหลายปีแล้วแต่ผมเคยมีปัญหาตอนจ่ายตังหลายปีแล้วแต่ผมเคยมีปัญหาตอนจ่ายตังหลายปีแล้วแต่ผมเคยมีปัญหาตอนจ่ายตังหลายปีแล้วแต่ผมเคยมีปัญหาตอนจ่ายตังหลายปีแล้วแต่ผมเคยมีปัญหาตอนจ่ายตังหลายปีแล้วแต่ผมเคยมีปัญหาตอนจ่ายตังหลายปีแล้วแต่ผมเคยมีปัญหาตอนจ่ายตังหลายปีแล้วแต่ผมเคยมีปัญหาตอนจ่ายตังหลายปีแล้ว'
t1 = Time.now
for i in 1..10000
puts word_breaker.break_into_words(line).join("|")
end
t2 = Time.now
puts t2-t1
cRuby, jRUby, TruffleRuby에서 이 스크립트로:
#!/bin/bash
IMPLS=("cruby1" "jruby1" "truffle1")
for i in $(seq 1 10); do
for j in ${IMPLS[*]}; do
echo $i,$j,$(docker run --rm -it -v $(pwd):/work -w /work $j ruby wbrk2.rb | tail -n1)
done
done
Dockerfile.cruby:
FROM ruby:3.1
RUN gem install thailang4r
Dockerfile.jruby:
FROM jruby
RUN gem install thailang4r
도커파일.트러플:
FROM ghcr.io/graalvm/truffleruby:22
RUN gem install thailang4r
cRuby
jRuby
트러플루비
1
16.42368491
54.169815
11.385601
2
16.58381034
51.668375
11.99536
삼
16.47655229
53.584401
12.088978
4
17.52281777
54.222869
10.893925
5
16.92775603
54.912019
12.24505
6
16.89063941
52.43011
11.413859
7
17.12419062
57.041267
11.395317
8
17.51911099
51.571193
11.551416
9
16.97416603
51.805853
11.578309
10
16.79307381
51.006189
12.517783
평균
16.92358022
53.2412091
11.7065598
속도
1X
0.32X
1.45X
TruffleRuby의 wbrk2는 cRuby의 1.45배 속도로 실행되었습니다. jRuby의 wbrk2는 cRuby의 0.32배 속도로 실행되었습니다.
Reference
이 문제에 관하여(TruffleRuby 시도), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/veer66/trying-truffleruby-577d텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)