The performance between the 'normal' operation and the 'shift' operation.
First, I gonna post my test result with some code:
//test the peformance of the <normal operation> and the <shift operation>.
class ShiftOperation
{
public static void main(String[] args)
{
long startTime1 = System.nanoTime();
for(long i = 0; i < 10000000000L; i++){
int temp = 128 * 128;
}
long endTime1 = System.nanoTime();
System.out.println("elapse = " + (endTime1 - startTime1) + " ns");
//outputs:elapse = 13265249285 ns long startTime2 = System.nanoTime();
for(long i = 0; i < 10000000000L; i++){
int temp = 128 << 8;
}
long endTime2 = System.nanoTime();
System.out.println("elapse = " + (endTime2 - startTime2) + " ns");
//outputs:elapse = 12723663971 ns
}
}
The below screen shot shows the simple steps of the operations between the two.
The performance between the 'normal' operation and the 'shift' operation.的更多相关文章
- Ubuntu 出现 Invalid operation update 或 Invalid operation upgrade的解决办法
输入 sudo apt update && sudo apt full-upgrade
- iOS 并发编程之 Operation Queues
现如今移动设备也早已经进入了多核心 CPU 时代,并且随着时间的推移,CPU 的核心数只会增加不会减少.而作为软件开发者,我们需要做的就是尽可能地提高应用的并发性,来充分利用这些多核心 CPU 的性能 ...
- System and method for dynamically adjusting to CPU performance changes
FIELD OF THE INVENTION The present invention is related to computing systems, and more particularly ...
- RFC 8684---TCP Extensions for Multipath Operation with Multiple Addresses
https://datatracker.ietf.org/doc/rfc8684/?include_text=1 TCP Extensions for Multipath Operation with ...
- iOS:缓存与Operation优先级问题
这篇博客来源于今年的一个面试题,当我们使用SDWebImgae框架中的sd_setImageWithURL: placeholderImage:方法在tableView或者collectionView ...
- Thinking Clearly about Performance
http://queue.acm.org/detail.cfm?id=1854041 The July/August issue of acmqueue is out now acmqueue is ...
- Async Performance: Understanding the Costs of Async and Await
Stephen Toub Download the Code Sample Asynchronous programming has long been the realm of only the m ...
- 多线程:Operation(一)
1. 进程和线程 1.1 进程 进程:正在运行的应用程序叫进程 进程之间都是独立的,运行在专用且受保护的内存空间中 两个进程之间无法通讯 通俗的理解,手机上同时开启了两个App.这两个App肯定是在不 ...
- Task-based Asynchronous Operation in WCF z
Download source - 93.5 KB Introduction Though performance blocking and sluggishness are the tailback ...
随机推荐
- QT获得所有系统环境变量(包括Linux和MAC的信息)
系统环境变量还是挺重要的,除了QStandardPaths(感觉都是文档类型的变量,QT4使用QDesktopServices),更有QProcessEnvironment(都是真正的系统变量): Q ...
- How to read video frames in hadoop?如何在Hadoop中读取视频帧?
To process specialized file formats (such as video) in Hadoop, you'd have to write a custom InputFor ...
- hdu 2289 Cup (二分法)
http://acm.hdu.edu.cn/showproblem.php?pid=2289 二分法解题. 这个题很恶心...一开始测试样例都不能过,这个π一开始取3.1415926结果是99.999 ...
- nbtstat Linux版源码, 通过IP获取主机名
nbtstat Linux版, 通过IP获取主机名/* NETBIOS name lookup tool - by eSDee of Netric (www.netric.org) * yeh.. i ...
- once
var once = function(obj, evtType, handler) { var f = function() { //console.log(arguments) handler.a ...
- spring中context:property-placeholder/元素 转载
spring中context:property-placeholder/元素 转载 1.有些参数在某些阶段中是常量 比如 :a.在开发阶段我们连接数据库时的连接url,username,passwo ...
- pm grant 命令
CustomLocale.apk所需要的权限"android.permission.CHANGE_CONFIGURATION"自Android 4.2,4.2.2起系统定义为and ...
- 【原】hive 操作笔记
1.建表: hive> CREATE TABLE pokes (foo INT, bar STRING); hive> CREATE TABLE invites (foo INT, bar ...
- poj 1328贪心
Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea i ...
- AlphaDict 软件公布
今天 Release 了 1.1. 主要是移植到了 window 平台, 无须安装,直接执行. 对 UI 又一次进行了设计,应该比之前好看多了. 加入了 生词本 功能,方便 学习外语. ------- ...