《Ruby/YARV/Python跨平台性能对比测试报告》(附单词频率统计实例)

理性分析Python和Ruby哪个更有前途? 就第一语言而言,Ruby和Python是最受欢迎的。Ruby是非常流行的构建网站技术,其中最著名的是Twitter(早期版本),Basecamp,Github,Airbnb,Slideshare,Groupon。Ruby和Python都是面向对象的语言,都是动态和灵活的。这些技术的主要区别在于他们解决问题的方式。Ruby提供了不同的方法,而Python通常只有一个。这个事实既是优势也劣势。最流行的... 阅读详情

Ruby/YARV/Python跨平台性能对比测试报告
作者:Suninny   http://blog.csdn.net/rails

一、基本测试

Ruby代码:

def test
  count 
= Hash.new(0)
  File
.read('test.txt').split.each {|word| count[word] += 1 }
  p count
.to_a.sort_by{|x| x[1]}[-30, 30].reverse
end

if __FILE__ == $0
  t1 
= Time.now
  test
  puts t2 
= Time.now - t1
end

 Python代码:

from time import time
from operator import itemgetter

def test():
    count 
= {} 
    
for word in open("test.txt").read().split():
        
if count.has_key(word):
            count[word] 
= count[word] + 1
        
else:
            count[word] 
= 1
    
print sorted(count.iteritems( ), key=itemgetter(1), reverse=True)[0:30]

if __name__ == "__main__":
    t1 
= time()
    test()
    
print time()-t1

都蛮简洁的。由于Ruby支持带默认值的初始化,少了几行代码。

输出结果为:

[["the", 11345], ["of", 6538], ["to", 5496], ["and", 4611], ["a", 3509], ["in",2940], ["that", 2511], ["was", 2439], ["his", 2346], ["he", 1913], ["as", 1860], ["had", 1363], ["is", 1359], ["it", 1273], ["not", 1231], ["be", 1208], ["for", 1125], ["on", 1075], ["with", 1068], ["this", 1045], ["by", 878], ["The", 851], ["I", 840], ["have", 836], ["but", 806], ["which", 796], ["all", 787], ["their", 749], ["so", 747], ["at", 740]]

Ruby1.8.4@Win32耗时:0.641s
Python2.5@Win32耗时:0.310s;启用Psyco:0.249s
Ruby1.8.5@Cygwin:0.558s
Ruby-yarv@Cygwin:0.453s
Python2.5@Cygwin:0.312s;启用Psyco:0.246s
Ruby1.8.5@Ubuntu: 0.434s
Ruby-yarv@Ubuntu: 0.373s
Python2.5@Ubuntu:0.271s; Psyco: 0.196s


更新@2006.09.17, 19:03

刚发现Python也有类似于Ruby“默认值初始化”的特性,于是test()函数可以改为:

def test(): 
    count 
= {} 
    
for word in open("test.txt").read().split(): count[word] = 1 + count.get(word, 0) 
    
print sorted(count.iteritems( ), key=itemgetter(1), reverse=True)[0:30] 


二、加测内存占用情况

1、将测试文本扩大10倍,变成 9.5M,前面两个程序的时间和内存消耗分别为(括号中为psyco/yarv的分值):
ruby1.8.4@win32: 5.63,97M
ruby1.8.5@cygwin: 4.77s, 93M(3.84s, 95M)
ruby1.8.5@ubuntu: 3.78s, 91M (3.36s, 91M)
py2.5@win32: 2.51s, 65M(1.85s, 72M)
py2.5@cgwin: 2.58s, 80M(1.94s,110M)
py2.5@ubuntu:2.23s, 63M(1.42s, 63M)

2、因为两者用的都是将文件内容一次性读入数组的方法,所以内存占用量都很大,下面对其进行改进:

Ruby代码:

def test
  count 
= Hash.new(0)
  
for line in open("test.txt")
    
for word in line.split
      count[word] 
+= 1
    end
  end
  p count
.to_a.sort_by{|x| x[1]}[-30, 30].reverse
end

if __FILE__ == $0
  t1 
= Time.now
  test
  puts t2 
= Time.now - t1
end

Python代码:

from time import time
from operator import itemgetter

def test():
    count 
= {}
    
for line in open("test.txt"):
       
for word in line.split():
            count[word] 
= 1 + count.get(word, 0)
    
print sorted(count.iteritems(), key=itemgetter(1), reverse=True)[0:30]

if __name__ == "__main__":
    t1 
= time()
    test()
    
print time()-t1

输出为:

[('the', 113450), ('of', 65380), ('to', 54960), ('and', 46110), ('a', 35090), ('in', 29400), ('that', 25110), ('was', 24390), ('his', 23460), ('he', 19130), ('as', 18600), ('had', 13630), ('is', 13590), ('it', 12730), ('not', 12310), ('be', 12080), ('for', 11250), ('on', 10750), ('with', 10680), ('this', 10450), ('by', 8780), ('The', 8510), ('I', 8400), ('have', 8360), ('but', 8060), ('which', 7960), ('all', 7870), ('their', 7490), ('so', 7470), ('at', 7400)]

现在两个程序的时间和内存消耗分别为(括号中为psyco/yarv的分值):
ruby1.8.4@win32:7.3s,5M
ruby1.8.5@cygwin: 6.45s, 5M(6.04s, 5M)
ruby1.8.5@ubuntu: 4.25s, 3.2M(4.11s, 3.2M)

py2.5@win32: 2.34s, 3M(1.54s,5M)
py2.5@cygwin: 2.45s, 4M(1.74s, 6M)
py2.5@ubuntu: 2.25s, 1.7M(1.34s,1.8M)

注意:尽管Ruby的内存占用量只有原来的1/20,但速度也明显慢了下来;而Python内存占用一样骤减,速度也随之提升。

更新@2006.09.17, 22:50

这两个程序最后打印结果的那行都还可以稍稍作下改进:

Ruby的可以改为:

 p count.to_a.sort_by{|x| -x[1]}[0, 30]

Python的可以改用2.5版最新引入的nlargest()函数(新发现的很棒的东东,只是Ruby目前还未包含类似的函数,Ruby1.9也没看到,只有一个max_by):

print nlargest(30, count.iteritems(), key=itemgetter(1)) #from heapq import nlargest

更新@2006.09.18, 08:25    新增Ubuntu下的分值

Python经过这几年的发展,进步真的很大,不管是在性能还是标准库的扩充方面。而Ruby在这方面却令人有点失望,有时运行速度只及Python的1/3,YARV也形同虚设。值得注意的是两者在Ubuntu下的表现都不错,尤其是Ruby,有显著提升。
Python和Ruby哪个好? Ruby 和 Python十分相似,有很多共同点,但也有一些不同之外,以下是Python和Ruby的对比:1. Python和Ruby都是面向对象的语言,都是动态和灵活的。二者的主要区别在于他们解决问题的方式。Ruby提供了不同的方法,而Python通常只有一个,这既是优势也劣势。2. 最流行的Ruby框架是Ruby-on-Rails,跟Python的Django极其相似且同等高效,不过,如果开发... 阅读详情

相关推荐

AD936x Evaluation Software 详细配置

作者:ShownSun 工作室:时沿科技 文章目录AD936x Evaluation Software详细配置1 系统概述2 AD9361 Wireless Transceiver Evaluation Setup2.1 标签描述2.2 用户参数2.3详细配置3 AD936x RF Wizard3.1 标签描述3.2 用户参数3.3 详细配置4 AD936x Digital Filter Wizard4.1 标签描述4.1.1 时钟配置4.1.2 滤波器配置4.1.3 接收滤波器配置4.1.4 发射滤..

ShownSun博客 5211

YARV: 又一个ruby虚拟机

YARV的全名是 Yet Another Ruby VM, 由日本人SASADA Koichi 另外实现的ruby虚拟机 目前ruby的虚拟机是通过AST(abstract syntax tree) 来完成的,它的速度比较慢, 只能作一般纯脚本的解释工作, YARV的出现就是为了解决这个问题, 它是基于Stack VM来完成.主要的目的就是给ruby脚本提速 下面的图片显示了...

weixin_30558305的博客 343

Claude Code插件安装与VSCode深度集成实战指南

Claude Code是一款专为IDE设计的AI编程助手插件,其核心价值在于将自然语言意图转化为可运行代码,从而优化开发者认知带宽分配。它依赖Node.js运行时、git版本上下文和VSCode编辑器API三者协同工作,技术原理涉及本地进程通信、权限策略绕过、上下文感知补全等关键机制。该工具显著提升工程效率,适用于CLI开发、EXIF元数据处理、异步逻辑生成等典型JavaScript/TypeScript应用场景。本文聚焦Claude Code插件在VSCode中的真实落地链路,覆盖Windows/macO

weixin_34006468的博客 486

Ruby 2.x 源代码学习:YARV 虚拟机 指令

前言 YARV 大约有 90 多条指令,这些指令定义在 insns.def 文件中,编译 Ruby 源代码的时候会根据该文件生成 vm.inc 和 insns.inc 两个(include)文件,这两个文件会被包含在 Ruby 虚拟器核心代码里头 栈帧 虚拟机模拟物理机执行方法调用的方式, 每执行一个方法(or block)都会将一个 栈...

weixin_33671935的博客 307

告别手动打点!用Cesium为你的大疆无人机快速生成区域巡查航线(保姆级教程)

本文详细介绍了如何利用Cesium平台为大疆无人机快速生成区域巡查航线的保姆级教程。通过自动化航线规划,告别传统手动打点的繁琐操作,实现高效、无死角的区域覆盖。文章涵盖环境搭建、实战案例及高级优化技巧,特别适合无人机操作员和巡检工作者提升工作效率。

weixin_30399821的博客 525

洛谷P5707 【深基2.例12】上学迟到(c语言)

第一篇题解 题目描述 yyy 的学校要求早上 8 点前到达。学校到 yyy 的家一共有 s(s\le 10000)s(s≤10000) 米,而 yyy 可以以 v(v<10000)v(v<10000) 米每分钟的速度匀速走到学校。此外在上学路上它还要额外花 10 分钟时间进行垃圾分类。请问为了避免迟到 yyy 最晚什么时候出门?输出 HH:MM 的时间格式,不足两位时补零。由于路途遥远, yyy 可能不得不提前一天出发,不过不可能提前超过一天。 输入格式 两个正整数 s,v,意思已经在题目中给定

cc_love_program的博客 1万+

python和ruby性能比较_Ruby和Python的比较

python和ruby的相同点:都强调语法简单,都具有更一般的表达方式。python是缩进,ruby是类basic的表达。都大量减少了符号。都是动态数据类型。都是有丰富的数据结构。都具有c语言扩展能力,都具有可移植性,比perl的可移植性更好。也都可以作为嵌入语言。都是面向对象的语言,都可以作为大项目的开发工具。都有丰富的库支持。也有最宽松的版权许可,除了一些工具属于GNU世界。都有lisp特色的...

weixin_42506994的博客 1466

CCC数字钥匙3.0标准解读(16)

介绍通信过程最重要部分:身份认证和加密.介绍需要身份认证的过程和需要加密的数据及过程.

weixin_41738640的博客 1545

Ruby 和 Python 相比有什么优势和缺陷?

转自:http://www.zhihu.com/question/19552194 知乎工程师 汪汪、Xana Hopper、yao long 等人赞同 Ruby 和 Python 太相似了,取舍大部分都是个人喜好上的原因。比如我就觉得 Python 的 “There is only one way to do it.” 比 Ruby 的 “There are many ways to do

shellching的专栏 7899

YOLO26涨点改进| TGRS 2026 | 独家自研创新、检测头改进篇| AHATHead自适应混合注意力检测头,二次创新,强化特征表达与目标判别能力,适合遥感小目标检测、小目标检测有效涨点

🔥本文提出了一种改进YOLO26模型的AHATHead自适应混合注意力检测头,通过融合全局与局部注意力机制增强特征表达能力。该方法采用动态权重分配策略,在预测阶段自动调整关键区域与通道特征权重,有效提升小目标和密集场景的检测性能。实验表明,AHATHead在保持较高推理效率的同时,显著提高了目标定位精度与类别判别能力。文章详细介绍了模块结构、实现原理和代码集成步骤,并提供了两种改进配置方案(yolo26_AHATHead.yaml和yolo26_RFHA-YOLO-AHATHead.yaml)

Ai缝合怪、助力小伙伴高效发论文 173

Google Earth Engine(GEE)—— 显示如何使用迁移的训练样本进行多年分类的脚本(sentinel-2影像为例)光谱差异()

HydroSHEDS 是一种地图产品,它以一致的格式为区域和全球范围的应用程序提供水文信息。它提供了一套不同比例的地理参考数据集(矢量和栅格),包括河流网络、流域边界、排水方向和流量累积。请注意,对于北纬 60 度以上的地区,HydroSHEDS 数据的质量明显较低,因为没有可用的基础 SRTM 高程数据,因此分辨率较低的 DEM(USGS 提供的 HYDRO1k)。该数据集基于 15 角秒(赤道约 500 米)分辨率栅格数据提供嵌套的分层分水岭多边形。光谱信息和之前不同的点:训练结果。

此星光明博客 970

python平台无关性_《Ruby/YARV/Python跨平台性能对比测试报告》(附单词频率统计实例)...

详情请进入我的博客,不足之处还望各位同学多多指正:http://blog.csdn.net/Rails/archive/2006/09/17/1232993.aspx)目 标:从一个文件中选出使用频率最多的30个单词Ruby代码:def testcount = Hash.new(0)for line in open("test.txt")for word in line.splitcount[w...

weixin_39666550的博客 133

AI爬虫:一文讲通AI爬虫技术和原理,及34个AI爬虫工具推荐

AI 爬虫 是一种结合了传统网络爬虫技术和人工智能(AI)技术的工具,能够更智能、高效地从网页中提取和处理数据。与传统爬虫相比,AI 爬虫能够更好地处理动态内容、复杂网页结构以及非结构化数据,同时具备数据清洗、分类、情感分析等高级功能。

数据知道的博客 1万+

Python和Ruby的对比,纠正一些误解

Python和Ruby的对比,纠正一些误解下面是我在看两篇关于Python和Ruby对比的文章时,所作的纠正,原文都是广泛流行的,比较好找。------------------------------------------------------《ruby和python的比较》更正一点事情1、文档、开源项目、库支持,这些东西Ruby不要跟Python比,不是几个数量级的问题,何必貌似并列的排

河边的小屋 2万+

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

新版YARV(基于Ruby 1.9.0 v2006-11-01)编译/安装/测试手记

昨晚作SVN例行更新时发现了这次变动。今天有空,作了个尝试:一、Win32平台下安装 cd /yarv-svn/win32 configure nmake(需要用到Bison,我用的是Cygwin带的) nmake install-nodoc默认会安装在当前盘符根目录下的/usr文件夹C:/usr/bin>ruby -vruby 2.0.0 (Base: Ruby 1.9.0

Rails.blogging { Gooday :here } 1543

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

编程语言 Ruby 如何还能再活 25 年?

点击上方“CSDN”,选择“置顶公众号”关键时刻,第一时间送达!Ruby 创始人说:“我们要想尽一切办法活下去。”【CSDN编者按】全球 Ruby 社区是友善与支持的代名词,人们用“Matz 人很好,所以我们也很友好”来形容它。多年来 Ruby 语言一直很流行,特别是那些需要处理大量繁重工作的初创公司。今年2 月份的时候,Ruby 举行了 25 周年庆,而Ruby 已经发展成熟,Ruby 的流行部

CSDN资讯 3734

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

全面详解Python与Ruby,到底哪款更优秀

今天,我和大家讨论一下是Python开发语言web好还是Ruby开发语言web好,有需要的小伙伴,可以参考一下。对这方面有自己见解的大神,可以交流一下。希望大家可以认真阅读哦! Python 和 Ruby 都是目前用来开发 websites、web-based apps 和 web services 的流行编程语言之一。   这两种语言在许多方面有相似之处。它们都是高级的面向对象的

zyj66666的博客 6231

ruby和python性能比较_ruby和python的比较

python和ruby的相同点:都强调语法简单,都具有更一般的表达方式。python是缩进,ruby是类basic的表达。都大量减少了符号。都是动态数据类型。都是有丰富的数据结构。都具有c语言扩展能力,都具有可移植性,比perl的可移植性更好。也都可以作为嵌入语言。都是面向对象的语言,都可以作为大项目的开发工具。都有丰富的库支持。也有最宽松的版权许可,除了一些工具属于GNU世界。都有lisp特色的...

weixin_36444661的博客 937

玩了一下YARV

今天下载了YARV,在Linux上面编译安装好了,跑了一下,感觉很不错呀。非常期待包含YARV的Ruby2.0早日发布。 [quote] robbin@javaeye:~> ruby -v ruby 1.8.4 (2005-12-24) [x86_64-linux] robbin@javaeye:~> /usr/local/yarv/bin/ruby -v ruby 2.0.0 ...

robbin的专栏 260

Python和Ruby两大语言全方位对比

最近在考虑学习一门后端语言,在Ruby和Python直接犹豫,然后自己做了一些对比,希望能帮到有同样问题的你。 一、异同对比选择 1、Python和ruby的相同点: 都强调语法简单,都具有更一般的表达方式。python是缩进,ruby是类basic的表达。都大量减少了符号。 都是动态数据类型。都是有丰富的数据结构。 都具有C语言扩展能力,都具有可移植...

weixin_33964094的博客 586

python和ruby性能比较_Python和Ruby两大语言全方位对比

不合点别的,提到unix对象。Red hat Linux的安装法度榜样一向是用Python写的,如不雅你刚巧用ubuntu,那么,那个提示你更新体系的法度榜样,也是用Python写的。与Python不合, 在Ruby中,…Strings是可以改变的。你可以应用常量(常量的值是不合改变的)。这里有些强迫规定的书写请求 (例如:class的名字以大年夜写字母开首, 变量名已小写字母开首)。这里只有...

weixin_39686192的博客 388

Python 和 Ruby 的对比

(点击上方公众号,可快速关注) 来源:js信仰者 segmentfault.com/a/1190000010756033 如有好文章投稿,请点击 → 这里了解详情 最近在考虑学习一门后端语言,在ruby和python直接犹豫,然后自己做了一些对比,希望能帮到有同样问题的你。 一、异同对比选择 1、Python和ruby的相

Python开发者 3142

python和ruby性能比较_Python与Ruby比较

从三个方面:1.各自所适用于什么应用2.开发环境、运行环境3.可移植性如何,因为项目最后计划移植到手机平台,如windows CE Symbina现把调研的一些大致整理,对比一下Python与Ruby1.各自所适用于的应用场合查阅的结果似乎对于这两种语言的评价都很好,在网络开发上的性能都很好。都很适用于快速的应用程序开发,开发的效率很高。Python:摘取了跟项目有关的一些应用方面的叙述跨平台开发...

weixin_39683144的博客 684
上一篇: [比较编程]Sorting in Ruby and Python
下一篇: 值得关注一下djangobook.com
懒懒阳光
博客等级 码龄21年 3粉丝 45原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值