您看到的最荒谬的悲观是什么? [英] What is the most ridiculous pessimization you've seen?

查看:69
本文介绍了您看到的最荒谬的悲观是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都知道,过早的优化是万恶之源,因为它会导致无法读取/无法维护的代码.更悲观的是悲观主义,因为某人实施优化"是因为他们认为会更快,但最终会变得更慢,而且有漏洞,无法维护等.最可笑的例子是您已经看到了吗?

We all know that premature optimization is the root of all evil because it leads to unreadable/unmaintainable code. Even worse is pessimization, when someone implements an "optimization" because they think it will be faster, but it ends up being slower, as well as being buggy, unmaintainable, etc. What is the most ridiculous example of this that you've seen?

推荐答案

在一个旧项目中,我们继承了一些具有丰富Z-8000经验的(否则为优秀)嵌入式系统程序员.

On an old project we inherited some (otherwise excellent) embedded systems programmers who had massive Z-8000 experience.

我们的新环境是32位Sparc Solaris.

Our new environment was 32-bit Sparc Solaris.

一个家伙走了,将所有int都改为short以加快我们的代码的速度,因为从RAM抓取16位比抓取32位要快.

One of the guys went and changed all ints to shorts to speed up our code, since grabbing 16 bits from RAM was quicker than grabbing 32 bits.

我必须编写一个演示程序来显示在32位系统上获取32位值比获取16位值要快,并说明要获取16位值,CPU必须将32位值转换为32位值.位宽的内存访问,然后屏蔽或移位16位值不需要的位.

I had to write a demo program to show that grabbing 32-bit values on a 32-bit system was faster than grabbing 16-bit values, and explain that to grab a 16-bit value the CPU had to make a 32-bit wide memory access and then mask out or shift the bits not needed for the 16-bit value.

这篇关于您看到的最荒谬的悲观是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆