首页 \ 问答 \ 成都网站建设公司哪家比较好?

成都网站建设公司哪家比较好?

最近公司要建设一个企业网站,交由我这边负责 在百度里一搜好多家网络公司,想找一家好点的网络公司长期的合作,我们在网站建设好了后网站推广方面的业务也会跟着做起来,所以想找一家服务、口碑好的网络公司长期合作,请问有没有在这方面做的比较好的? 对了我们老大很看重品牌设计和网站后期的推广营销方面哈,希望大家推荐几家我这边进行一个筛选,谢谢大家了!
更新时间:2024-01-28 13:01

最满意答案

让我们更好地进行测试,运行每个迭代10000次,并从后者中排除函数定义时间(仅计算运行时):

>>> import timeit
>>> c1='''
... num = 600851475143
... while num % 2 == 0:
...     num /= 2
... if num == 1:
...     i = 2
... else:
...     i = 3
...     while num > 1:
...         if num % i == 0:
...             num /= i
...         else:
...             i += 2
... '''
>>> timeit.timeit(c1, number=10000)
3.5007779598236084

......和替代方案:

>>> c2_setup='''
... def lpf(num):
...     while num % 2 == 0:
...         num /= 2
...     if num == 1:
...         return 2
...     else:
...         i = 3
...         while num > 1:
...             if num % i == 0:
...                 num /= i
...             else:
...                 i += 2
...         return i
... '''
>>> c2_run='l = lpf(600851475143)'
>>> timeit.timeit(setup=c2_setup, stmt=c2_run, number=10000)
3.3825008869171143

......差异小得多


那么,为什么会有任何差异呢? 用语言无关的术语来说,更容易优化局部变量的变化; 它们不需要写入一个范围,任何其他可能正在运行或未运行的执行线程都可以访问它们。 在JITted编译器(如PyPi或JVM)中,对locals的更改实际上可能最终被实现为寄存器修改,根本不会转到CPU外部内存。

CPython没有JIT支持,但@chepner给了我们答案:全局变量的读取使用更昂贵的LOAD_GLOBAL指令,而不是LOAD_FAST可用的LOAD_FAST


Let's do a better job of testing, running 10,000 iterations of each, and excluding the function definition time from the latter (to count only runtime):

>>> import timeit
>>> c1='''
... num = 600851475143
... while num % 2 == 0:
...     num /= 2
... if num == 1:
...     i = 2
... else:
...     i = 3
...     while num > 1:
...         if num % i == 0:
...             num /= i
...         else:
...             i += 2
... '''
>>> timeit.timeit(c1, number=10000)
3.5007779598236084

...and the alternative:

>>> c2_setup='''
... def lpf(num):
...     while num % 2 == 0:
...         num /= 2
...     if num == 1:
...         return 2
...     else:
...         i = 3
...         while num > 1:
...             if num % i == 0:
...                 num /= i
...             else:
...                 i += 2
...         return i
... '''
>>> c2_run='l = lpf(600851475143)'
>>> timeit.timeit(setup=c2_setup, stmt=c2_run, number=10000)
3.3825008869171143

...a far smaller difference.


So, why any difference at all? To put it in language-agnostic terms, it's easier to optimize away changes to local variables; they don't need to be written to a scope where they're accessible by any other threads of execution which may or may not be running. In a JITted compiler (like PyPi or the JVM), changes to locals may actually end up being implemented as register modifications that don't go to off-CPU memory at all.

CPython doesn't have JIT support, but @chepner gave us our answer there: Reads from global variables use a more expensive LOAD_GLOBAL instruction, vs the LOAD_FAST available for locals.

相关问答

更多
  • 让我们更好地进行测试,运行每个迭代10000次,并从后者中排除函数定义时间(仅计算运行时): >>> import timeit >>> c1=''' ... num = 600851475143 ... while num % 2 == 0: ... num /= 2 ... if num == 1: ... i = 2 ... else: ... i = 3 ... while num > 1: ... if num % i == 0: ... ...
  • 存储局部变量比全局变量更快。 局部变量存储在固定大小的数组中,其中全局变量存储在真实的字典中。 这是一个更深入的答案的链接 It is faster to store local variables than it is for global variables. Local variables are stored in a fixed-sized array, where as global variables are stored in a true dictionary. Here is a lin ...
  • 这里有几个并行的问题。 第一个是并行解决问题总是涉及执行更多的实际工作而不是按顺序执行。 开销涉及在多个线程之间分割工作,并加入或合并结果。 将短字符串转换为小写字体的问题足够小,以至于它们被并行拆分开销所淹没的危险。 第二个问题是,基准测试Java程序非常微妙,很容易弄出混乱的结果。 两个常见的问题是JIT编译和死代码消除。 短的基准测试经常在JIT编译之前或期间完成,因此它们不测量峰值吞吐量,实际上它们可能正在测量JIT本身。 编译发生时有些不确定,所以可能导致结果变化很大。 对于小的综合基准,工作负载 ...
  • 你的函数在每个循环迭代中调用一个length方法。 似乎编译器不会缓存它。 要将此矢量的存储大小修改为单独的变量或使用基于范围的循环。 另外请注意,我们并不需要显式缺少值检查,因为在C ++中,所有涉及NaN比较都会返回false 。 我们来比较一下性能: #include using namespace Rcpp; // [[Rcpp::export]] IntegerVector tabulate1(const IntegerVector& x, const unsigned max ...
  • 在c ++中我建议使用std::chrono来计算持续时间: 在开始应用程序的主循环之前,请记住开始时间: #include typedef std::chrono::high_resolution_clock TClock; typedef std::chrono::duration Tms; TClock::time_point start_time; // global start time .... start_time = TClock ...
  • 其他人已经在评论中回答了。 所以我只强调一点:回调R函数的代价很高,因为我们需要对错误处理格外小心。 只用C ++循环并调用R函数不会在C ++中重写您的代码。 尝试将psi和pFGM重写为C ++函数,并在此处向我们报告发生的情况。 你可能会认为你失去了一些灵活性,并且你不能再使用任何R函数。 对于这样的情况,我建议使用某种混合解决方案,其中您已经在C ++中实现了最常见的情况,否则将回退到R解决方案。 至于另一个问题,一个SEXP是一个R对象。 这是R API的一部分。 它可以是任何东西。 当你从它创建 ...
  • 请在TOOLS-> Options-> Debugging-> Symbols下禁用符号服务器。 博客还向我们分享了一些可以使调试更快的建议: https://blogs.msdn.microsoft.com/visualstudioalm/2015/03/03/make-debugging-faster-with-visual-studio/ Please disable the symbols server under TOOLS->Options->Debugging->Symbols. A blog ...
  • 关于最佳chunksize: 拥有大量的小块将允许4个不同的工人更有效地分配负载,因此需要更小的块。 另一方面,每次必须处理新块时,与进程相关的上下文更改会增加开销,因此需要更少量的上下文更改,因此需要更少的块。 由于这两个规则都需要不同的方法,因此中间的一个点是要走的路,类似于供需图表。 About optimal chunksize: Having tons of small chunks would allow the 4 different workers to distribute the loa ...
  • eval基本上是不可优化的,因为编译器不知道它在做什么。 即使将其保存到函数中,编译器也必须选择退出很多优化,因为以某种方式更改代码可能会破坏eval函数。 这就是为什么通常,当你需要执行eval时,你可以在另一个函数中执行:这样,编译器可以确保你没有修改eval局部范围,并且更好地优化了。 JS VMs真的很多关于启发式方法。 他们试图猜测你想做什么,并针对一般情况进行优化。 eval (或new Function )阻止他们做很多事情。 Function.new 可能会快一点,因为编译器会知道它不会尝试 ...
  • 首先,就像在评论中暗示的那样,使用omp_get_wtime()而不是clock() (它将为您提供在所有线程中累积的时钟滴答数)来测量时间。 其次,如果我没记错,这个算法有负载均衡问题,所以尝试使用动态调度: //timer start double begin = omp_get_wtime(); #pragma omg parallel for private(j,x,y, esc_time) schedule(dynamic, 1) for(i = 0; i < w; ++i) { x = ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。