1.minor gc 也需要STW,只不过正常情况下 minor gc STW时间非常短,所以很多人误以为没有STW. 这里的正常情况是,Eden 区产生的新对象大部分被回收了,不需要拷贝. 2.Minor GC 采用的是标记复制算法,具体过程如下图: 3.为什么minor gc 比full gc 快? minor gc 只针对 young 区, full gc 针对所有区,包括young gen.old gen.perm gen. minor gc 和 full gc 都是从 gc r
首先要看一个问题,if 语句适用范围比较广,只要是 boolean 表达式都可以用 if 判断:而 switch 只能对基本类型进行数值比较.两者的可比性就仅限在两个基本类型比较的范围内.说到基本类型的数值比较,那当然要有两个数.然后重点来了--if 语句每一句都是独立的,看下面的语句:if (a == 1) ...else if (a == 2) ...这样 a 要被读入寄存器两次,1 和 2 分别被读入寄存器一次.于是你是否发现其实 a 读两次是有点多余的,在你全部比较完之前只需要一次读入寄
比如: select id, name from table1 where name = 'x' union all select id, name from table2 where name = 'x' 与select * from (select id, name from table1 union all select id, name from table2) where name = 'x'. 哪一种方式性能更好一些呢? 希望高手能详细说明下, 并且考虑到有索引和无索引的情
代码: public class main { public static void main(String[] p_args){ ArrayList<String> _l_string = new ArrayList<>(); for (int o_a = 0; o_a < 100000; o_a++) { _l_string.add(String.valueOf(o_a)); } c_public_countTime _countTime = new c_public_c
原文:Faster Alternative to PHP’s Array Unique Function 概述 使用PHP的array_unique()函数允许你传递一个数组,然后移除重复的值,返回一个拥有唯一值的数组.这个函数大多数情况下都能工作得很好.但是,如果你尝试在一个大的数组里使用array_unique()函数,它会运行地慢一些. 有一个比较好而且更快的函数array_flip()来替代使用array_unique()函数来创建唯一的数组.这个魔法般的函数会交换数组里面每一个元素的键