Java队列集合的性能测试

同时开10个线程存入和取出100万的数据,结论如下:

DoubleBufferedQueue < ConcurrentLinkedQueue < ArrayBlockingQueue < LinkedBlockingQueue


执行结果如下:

100万 DoubleBufferedQueue入队时间:9510 出队时间:10771
100万 DoubleBufferedQueue入队时间:8169 出队时间:9789
1000万 DoubleBufferedQueue入队时间:98285 出队时间:101088
1000万 DoubleBufferedQueue入队时间:101859 出队时间:105964

100万 ConcurrentLinkedQueue入队时间:10557 出队时间:13716
100万 ConcurrentLinkedQueue入队时间:25298 出队时间:25332
1000万 ConcurrentLinkedQueue队列时间:121868 出队时间:136116
1000万 ConcurrentLinkedQueue队列时间:134306 出队时间:147893

100万 ArrayBlockingQueue入队时间:21080 出队时间:22025
100万 ArrayBlockingQueue入队时间:17689 出队时间:19654
1000万 ArrayBlockingQueue入队时间:194400 出队时间:205968
1000万 ArrayBlockingQueue入队时间:192268 出队时间:197982

100万 LinkedBlockingQueue入队时间:38236 出队时间:52555
100万 LinkedBlockingQueue入队时间:30646 出队时间:38573
1000万 LinkedBlockingQueue入队时间:375669 出队时间:391976
1000万 LinkedBlockingQueue入队时间:701363 出队时间:711217

 

doubleBufferedQueue:

package test.MoreThread.d;import java.util.ArrayList;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;import test.MoreThread.l.linkedBlockingQueue;
import comrt.util.DoubleBufferedQueue;//DoubleBufferedQueue入队时间:9510  出队时间:10771
//DoubleBufferedQueue入队时间:8169  出队时间:9789
public class doubleBufferedQueue {private static final Logger log = LoggerFactory.getLogger(doubleBufferedQueue.class);public final static int size1 = 1000000;public static DoubleBufferedQueue<Object> queue = new DoubleBufferedQueue<Object>(size1);public final static int threadNumber = 10;public static boolean isOver = false;public static void main(String[] args) throws InterruptedException,ExecutionException {//        long timestart = System.currentTimeMillis();Thread thread1 = new Thread(new Runnable() {public void run() {ExecutorService executorService = Executors.newFixedThreadPool(threadNumber);ArrayList<Future<Long>> results = new ArrayList<Future<Long>>();for (int i = 0; i < threadNumber; i++) {Future<Long> future = executorService.submit(new ExecDoubleBufferedQueue());results.add(future);}long allTime = 0;for (Future<Long> fs : results) {try {allTime += fs.get();// log.info("" + fs.get());} catch (InterruptedException e) {log.info("" + e);return;} catch (ExecutionException e) {log.info("" + e);} finally {executorService.shutdown();}}doubleBufferedQueue.isOver = true;log.info("入队列总共执行时间:" + allTime);}});thread1.start();// log.info("主线程执行时间:" + (System.currentTimeMillis() - timestart));// ------------------------------Thread thread2 = new Thread(new Runnable() {public void run() {ExecutorService executorService2 = Executors.newFixedThreadPool(threadNumber);ArrayList<Future<Long>> results_out = new ArrayList<Future<Long>>();for (int i = 0; i < threadNumber; i++) {Future<Long> future = executorService2.submit(new ExecDoubleBufferedQueue_Out());results_out.add(future);}long allTime_out = 0;for (Future<Long> fs : results_out) {try {allTime_out += fs.get();// log.info("" + fs.get());} catch (InterruptedException e) {log.info("" + e);return;} catch (ExecutionException e) {log.info("" + e);} finally {executorService2.shutdown();}}log.info("出队列总共执行时间:" + allTime_out);}});thread2.start();}
}class ExecDoubleBufferedQueue implements Callable<Long> {private static final Logger log = LoggerFactory.getLogger(doubleBufferedQueue.class);@Overridepublic Long call() throws Exception {long time = System.currentTimeMillis();for (int i = 0; i < doubleBufferedQueue.size1; i++) {doubleBufferedQueue.queue.offer(i);}long time2 = System.currentTimeMillis() - time;// log.info("执行时间:" + time2);return time2;}
}class ExecDoubleBufferedQueue_Out implements Callable<Long> {private static final Logger log = LoggerFactory.getLogger(doubleBufferedQueue.class);@Overridepublic Long call() throws Exception {long time = System.currentTimeMillis();while (!doubleBufferedQueue.isOver) {doubleBufferedQueue.queue.poll();}long time2 = System.currentTimeMillis() - time;// log.info("执行时间:" + time2);return time2;}
}

 

concurrentLinkedQueue:

package test.MoreThread.c;import java.util.ArrayList;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;//ConcurrentLinkedQueue入队时间:10557  出队时间:13716
//ConcurrentLinkedQueue入队时间:25298  出队时间:25332
public class concurrentLinkedQueue {private static final Logger log = LoggerFactory.getLogger(concurrentLinkedQueue.class);public static ConcurrentLinkedQueue<Object> queue = new ConcurrentLinkedQueue<Object>();public final static int size1 = 1000000;public final static int threadNumber = 10;public static boolean isOver = false;public static void main(String[] args) throws InterruptedException,ExecutionException {// long timestart = System.currentTimeMillis();Thread thread1 = new Thread(new Runnable() {public void run() {ExecutorService executorService = Executors.newFixedThreadPool(threadNumber);ArrayList<Future<Long>> results = new ArrayList<Future<Long>>();for (int i = 0; i < threadNumber; i++) {Future<Long> future = executorService.submit(new Exec());results.add(future);}long allTime = 0;for (Future<Long> fs : results) {try {allTime += fs.get();
//                        log.info("" + fs.get());} catch (InterruptedException e) {log.info("" + e);return;} catch (ExecutionException e) {log.info("" + e);} finally {executorService.shutdown();}}concurrentLinkedQueue.isOver = true;log.info("队列总共执行时间:" + allTime);}});thread1.start();// ------------------------------Thread thread2 = new Thread(new Runnable() {public void run() {ExecutorService executorService2 = Executors.newFixedThreadPool(threadNumber);ArrayList<Future<Long>> results_out = new ArrayList<Future<Long>>();for (int i = 0; i < threadNumber; i++) {Future<Long> future = executorService2.submit(new Exec_Out());results_out.add(future);}long allTime_out = 0;for (Future<Long> fs : results_out) {try {allTime_out += fs.get();// log.info("" + fs.get());} catch (InterruptedException e) {log.info("" + e);return;} catch (ExecutionException e) {log.info("" + e);} finally {executorService2.shutdown();}}log.info("出队列总共执行时间:" + allTime_out);}});thread2.start();// log.info("主线程执行时间:" + (System.currentTimeMillis() - timestart));
    }
}class Exec implements Callable<Long> {private static final Logger log = LoggerFactory.getLogger(concurrentLinkedQueue.class);@Overridepublic Long call() throws Exception {long time = System.currentTimeMillis();for (int i = 0; i < concurrentLinkedQueue.size1; i++) {concurrentLinkedQueue.queue.offer(i);}long time2 = System.currentTimeMillis() - time;
//        log.info("执行时间:" + time2);return time2;}
}class Exec_Out implements Callable<Long> {private static final Logger log = LoggerFactory.getLogger(concurrentLinkedQueue.class);@Overridepublic Long call() throws Exception {long time = System.currentTimeMillis();while (!concurrentLinkedQueue.isOver) {concurrentLinkedQueue.queue.poll();}long time2 = System.currentTimeMillis() - time;// log.info("执行时间:" + time2);return time2;}
}

 

arrayBlockingQueue:

package test.MoreThread.a;import java.util.ArrayList;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;//ArrayBlockingQueue入队时间:21080  出队时间:22025
//ArrayBlockingQueue入队时间:17689  出队时间:19654
public class arrayBlockingQueue {private static final Logger log = LoggerFactory.getLogger(arrayBlockingQueue.class);public final static int size1 = 1000000;public static ArrayBlockingQueue<Object> queue = new ArrayBlockingQueue<Object>(size1);public final static int threadNumber = 10;public static boolean isOver = false;public static void main(String[] args) throws InterruptedException,ExecutionException {// long timestart = System.currentTimeMillis();Thread thread1 = new Thread(new Runnable() {public void run() {ExecutorService executorService = Executors.newFixedThreadPool(threadNumber);ArrayList<Future<Long>> results = new ArrayList<Future<Long>>();for (int i = 0; i < threadNumber; i++) {Future<Long> future = executorService.submit(new ExecArrayBlockingQueue());results.add(future);}long allTime = 0;for (Future<Long> fs : results) {try {allTime += fs.get();// log.info("" + fs.get());} catch (InterruptedException e) {log.info("" + e);return;} catch (ExecutionException e) {log.info("" + e);} finally {executorService.shutdown();}}arrayBlockingQueue.isOver = true;log.info("队列总共执行时间:" + allTime);}});thread1.start();// log.info("主线程执行时间:" + (System.currentTimeMillis() - timestart));// ------------------------------Thread thread2 = new Thread(new Runnable() {public void run() {ExecutorService executorService2 = Executors.newFixedThreadPool(threadNumber);ArrayList<Future<Long>> results_out = new ArrayList<Future<Long>>();for (int i = 0; i < threadNumber; i++) {Future<Long> future = executorService2.submit(new ExecArrayBlockingQueue_Out());results_out.add(future);}long allTime_out = 0;for (Future<Long> fs : results_out) {try {allTime_out += fs.get();// log.info("" + fs.get());} catch (InterruptedException e) {log.info("" + e);return;} catch (ExecutionException e) {log.info("" + e);} finally {executorService2.shutdown();}}log.info("出队列总共执行时间:" + allTime_out);}});thread2.start();}
}class ExecArrayBlockingQueue implements Callable<Long> {private static final Logger log = LoggerFactory.getLogger(arrayBlockingQueue.class);@Overridepublic Long call() throws Exception {long time = System.currentTimeMillis();for (int i = 0; i < arrayBlockingQueue.size1; i++) {arrayBlockingQueue.queue.offer(i);}long time2 = System.currentTimeMillis() - time;// log.info("执行时间:" + time2);return time2;}
}class ExecArrayBlockingQueue_Out implements Callable<Long> {private static final Logger log = LoggerFactory.getLogger(arrayBlockingQueue.class);@Overridepublic Long call() throws Exception {long time = System.currentTimeMillis();while (!arrayBlockingQueue.isOver) {arrayBlockingQueue.queue.poll();}long time2 = System.currentTimeMillis() - time;// log.info("执行时间:" + time2);return time2;}
}

 

linkedBlockingQueue:

package test.MoreThread.l;import java.util.ArrayList;
import java.util.Vector;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;//LinkedBlockingQueue入队时间:38236  出队时间:52555
//LinkedBlockingQueue入队时间:30646  出队时间:38573
public class linkedBlockingQueue {private static final Logger log = LoggerFactory.getLogger(linkedBlockingQueue.class);public final static int size1 = 1000000;public static LinkedBlockingQueue<Object> queue = new LinkedBlockingQueue<Object>(size1);public final static int threadNumber = 10;public static boolean isOver = false;public static void main(String[] args) throws InterruptedException,ExecutionException {long timestart = System.currentTimeMillis();Thread thread1 = new Thread(new Runnable() {public void run() {ExecutorService executorService = Executors.newFixedThreadPool(threadNumber);ArrayList<Future<Long>> results = new ArrayList<Future<Long>>();for (int i = 0; i < threadNumber; i++) {Future<Long> future = executorService.submit(new ExecLinkedBlockingQueue());results.add(future);}long allTime = 0;for (Future<Long> fs : results) {try {allTime += fs.get();// log.info("" + fs.get());} catch (InterruptedException e) {log.info("" + e);return;} catch (ExecutionException e) {log.info("" + e);} finally {executorService.shutdown();}}linkedBlockingQueue.isOver = true;log.info("入队列总共执行时间:" + allTime);}});thread1.start();// log.info("主线程执行时间:" + (System.currentTimeMillis() - timestart));
//        System.out.println(linkedBlockingQueue.queue.size());// ------------------------------
Thread thread2 = new Thread(new Runnable() {public void run() {ExecutorService executorService2 = Executors.newFixedThreadPool(threadNumber);ArrayList<Future<Long>> results_out = new ArrayList<Future<Long>>();for (int i = 0; i < threadNumber; i++) {Future<Long> future = executorService2.submit(new ExecLinkedBlockingQueue_Out());results_out.add(future);}long allTime_out = 0;for (Future<Long> fs : results_out) {try {allTime_out += fs.get();// log.info("" + fs.get());} catch (InterruptedException e) {log.info("" + e);return;} catch (ExecutionException e) {log.info("" + e);} finally {executorService2.shutdown();}}log.info("出队列总共执行时间:" + allTime_out);}});thread2.start();}
}class ExecLinkedBlockingQueue implements Callable<Long> {private static final Logger log = LoggerFactory.getLogger(linkedBlockingQueue.class);@Overridepublic Long call() throws Exception {long time = System.currentTimeMillis();for (int i = 0; i < linkedBlockingQueue.size1; i++) {linkedBlockingQueue.queue.offer(i);}long time2 = System.currentTimeMillis() - time;// log.info("执行时间:" + time2);return time2;}
}class ExecLinkedBlockingQueue_Out implements Callable<Long> {private static final Logger log = LoggerFactory.getLogger(linkedBlockingQueue.class);@Overridepublic Long call() throws Exception {long time = System.currentTimeMillis();while (!linkedBlockingQueue.isOver) {linkedBlockingQueue.queue.poll();}long time2 = System.currentTimeMillis() - time;// log.info("执行时间:" + time2);return time2;}
}

 

DoubleBufferedQueue双缓冲队列

package comrt.util;import java.util.AbstractQueue;
import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;//双缓冲队列,线程安全
public class DoubleBufferedQueue<E> extends AbstractQueue<E> implements BlockingQueue<E>, java.io.Serializable {private static final long serialVersionUID = 1011398447523020L;public static final int DEFAULT_QUEUE_CAPACITY = 5000000;public static final long DEFAULT_MAX_TIMEOUT = 0;public static final long DEFAULT_MAX_COUNT = 10;private Logger logger =    LoggerFactory.getLogger(DoubleBufferedQueue.class.getName());/** The queued items */private ReentrantLock readLock;// 写锁private ReentrantLock writeLock;// 是否满private Condition notFull;private Condition awake;// 读写数组private transient E[] writeArray;private transient E[] readArray;// 读写计数private volatile int writeCount;private volatile int readCount;// 写数组下标指针private int writeArrayTP;private int writeArrayHP;// 读数组下标指针private int readArrayTP;private int readArrayHP;private int capacity;public DoubleBufferedQueue(int capacity) {// 默认this.capacity = DEFAULT_QUEUE_CAPACITY;if (capacity > 0) {this.capacity = capacity;}readArray = (E[]) new Object[capacity];writeArray = (E[]) new Object[capacity];readLock = new ReentrantLock();writeLock = new ReentrantLock();notFull = writeLock.newCondition();awake = writeLock.newCondition();}private void insert(E e) {writeArray[writeArrayTP] = e;++writeArrayTP;++writeCount;}private E extract() {E e = readArray[readArrayHP];readArray[readArrayHP] = null;++readArrayHP;--readCount;return e;}/*** switch condition: read queue is empty && write queue is not empty* * Notice:This function can only be invoked after readLock is grabbed,or may* cause dead lock* * @param timeout* @param isInfinite*            : whether need to wait forever until some other thread awake*            it* @return* @throws InterruptedException*/private long queueSwap(long timeout, boolean isInfinite) throws InterruptedException {writeLock.lock();try {if (writeCount <= 0) {// logger.debug("Write Count:" + writeCount// + ", Write Queue is empty, do not switch!");try {// logger.debug("Queue is empty, need wait....");if (isInfinite && timeout <= 0) {awake.await();return -1;} else if (timeout > 0) {return awake.awaitNanos(timeout);} else {return 0;}} catch (InterruptedException ie) {awake.signal();throw ie;}} else {E[] tmpArray = readArray;readArray = writeArray;writeArray = tmpArray;readCount = writeCount;readArrayHP = 0;readArrayTP = writeArrayTP;writeCount = 0;writeArrayHP = readArrayHP;writeArrayTP = 0;notFull.signal();// logger.debug("Queue switch successfully!");return 0;}} finally {writeLock.unlock();}}@Overridepublic boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException {if (e == null) {throw new NullPointerException();}long nanoTime = 0;if (timeout > 0) {nanoTime = unit.toNanos(timeout);}writeLock.lockInterruptibly();try {for (int i = 0; i < DEFAULT_MAX_COUNT; i++) {if (writeCount < writeArray.length) {insert(e);if (writeCount == 1) {awake.signal();}return true;}// Time outif (nanoTime <= 0) {// logger.debug("offer wait time out!");return false;}// keep waitingtry {// logger.debug("Queue is full, need wait....");nanoTime = notFull.awaitNanos(nanoTime);} catch (InterruptedException ie) {notFull.signal();throw ie;}}} finally {writeLock.unlock();}return false;}//
    @Overridepublic E poll(long timeout, TimeUnit unit) throws InterruptedException {long nanoTime = 0;if (timeout > 0) {nanoTime = unit.toNanos(timeout);}readLock.lockInterruptibly();try {if (nanoTime > 0) {for (int i = 0; i < DEFAULT_MAX_COUNT; i++) {if (readCount > 0) {return extract();}if (nanoTime <= 0) {// logger.debug("poll time out!");return null;}nanoTime = queueSwap(nanoTime, false);}} else {if (readCount > 0) {return extract();}queueSwap(nanoTime, false);if (readCount > 0) {return extract();} }} finally {readLock.unlock();}return null;}// 等待500毫秒
    @Overridepublic E poll() {E ret = null;try {ret = poll(DEFAULT_MAX_TIMEOUT, TimeUnit.MILLISECONDS);} catch (Exception e) {ret = null;}return ret;}// 查看
    @Overridepublic E peek() {E e = null;readLock.lock();try {if (readCount > 0) {e = readArray[readArrayHP];}} finally {readLock.unlock();}return e;}// 默认500毫秒
    @Overridepublic boolean offer(E e) {boolean ret = false;try {ret = offer(e, DEFAULT_MAX_TIMEOUT, TimeUnit.MILLISECONDS);} catch (Exception e2) {ret = false;}return ret;}@Overridepublic void put(E e) throws InterruptedException {// never need to // block
        offer(e, DEFAULT_MAX_TIMEOUT, TimeUnit.MILLISECONDS); }@Overridepublic E take() throws InterruptedException {return poll(DEFAULT_MAX_TIMEOUT, TimeUnit.MILLISECONDS);}@Overridepublic int remainingCapacity() {return this.capacity;}@Overridepublic int drainTo(Collection<? super E> c) {return 0;}@Overridepublic int drainTo(Collection<? super E> c, int maxElements) {return 0;}@Overridepublic Iterator<E> iterator() {return null;}// 当前读队列中还有多少个
    @Overridepublic int size() {int size = 0;readLock.lock();try {size = readCount;} finally {readLock.unlock();}return size;}/*** 当前已写入的队列大小* */public int WriteSize() {int size = 0;writeLock.lock();try {size = writeCount;} finally {writeLock.unlock();}return size;}public int unsafeReadSize() {return readCount;}public int unsafeWriteSize() {return writeCount;}public int capacity() {return capacity;}public String toMemString() {return "--read: " + readCount + "/" + capacity + "--write: " + writeCount + "/" + capacity;}// 清理/** public void clear() { readLock.lock(); writeLock.lock(); try { readCount* = 0; readArrayHP = 0; writeCount = 0; writeArrayTP = 0;* //logger.debug("Queue clear successfully!"); } finally {* writeLock.unlock(); readLock.unlock(); } }*/
}

 

转载于:https://www.cnblogs.com/zhuawang/p/4158486.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/292326.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

linux之man命令用法入门

man命令的解释: man的全称是manual,手册的意思,所以man命令有帮助解释其它命令的作用 基本用法: man + 命令 比如: man pwd 就会出现下面信息 PWD(1) User Commands PWD(1) //注意括号中的数字 NAME //关于命令的名次和说明pwd - print name of current/work…

Node webkit启动最大化窗口

<!DOCTYPE html> <html> <head> </head> <body> <p style"text-align:center;margin-top:10%;color:green;font-weight:bold;font-size:12px">正在加载中...</p> <script language"javascript" …

高效的动态URL限流实现

访问限流对于一个网关来说是个比较重要的功能&#xff0c;它可以根据不同服务的处理能力来控制相关的访问量&#xff0c;从而保障服务更可靠地运行。但是URL控制的路径比较多还加上可动态添加删除&#xff0c;大量的访问匹配会很容易引起性能上的问题&#xff0c;接下来讲解一下…

cocos2d-x学习 之一

最近准备学习cocos2d-x的开发&#xff0c;首先要搭建一下开发环境。今天就先搭建一下开发环境。本人系统为Mint-15 64位的linux&#xff0c;以下的开发环境只用于linux。首先到cocos2d-x的官网上下载安装包&#xff0c;由于cocos2d-x是开源的&#xff0c;所以我们可以查看源码&…

python里while的用法_Python学习笔记之While循环用法分析

本文实例讲述了Python学习笔记之While循环用法。分享给大家供大家参考&#xff0c;具体如下&#xff1a;前面一篇《Python学习笔记之For循环用法》详细介绍了Python for循环&#xff0c;这里再来讲述一下while循环的使用方法&#xff1a;Python 中的While循环For 循环是一种有限…

linux环境下最简单的C语言例子

1、装好linux系统和配置GCC环境 给自己的电脑上安装linux系统,比如我用大的是ubuntu,然后在ubuntu上配置GCC环境,如果不知道配置,请百度“linux上怎么配置GCC环境” 2、打开终端创建文件写代码 用组合命令打开终端 Ctrl+Alt+T 用vim创建文件编写代码 vim hello.c再点击下…

在 App 扩展和主 App 间共享数据

tags: iOS 8,Swift,App Groups 随着 iOS 8 的发布&#xff0c;苹果为广大开发者很多新的 API&#xff0c;其中最突出显著的就非 App Extension 莫属了。这为开发者们又带来了很多机会。 而我们在开发 App Extension 的时候&#xff0c;基本大多数人都会遇到这样一个问题。就是由…

Java8 (1)

参考资料&#xff1a; 《Java8 in Action》 Raoul-Gabriel Urma 一、jdk8 客观的说&#xff0c;Java8是一次有重大演进的版本&#xff0c;甚至很多人认为java8所做的改变&#xff0c;在许多方面都比Java历史上任何一次改变都深远。 Scala&#xff0c;python这样优秀编程语言中对…

[探索 .NET 6]02 比较 WebApplicationBuilder 和 Host

这是『探索 .NET 6』系列的第二篇文章&#xff1a;01 揭开 ConfigurationManager 的面纱02 比较 WebApplicationBuilder 和 Host在 .NET 中&#xff0c;有一种新的“默认”方法用来构建应用程序&#xff0c;即使用 WebApplication.CreateBuilder()。在这篇文章中&#xff0c;我…

python计算公式分母有0_你知道Python中的浮点除法和积分除法吗,python,float,整除,都...

从python2.2开始&#xff0c;便有两种除法运算符&#xff1a;"/"、"//"。两者最大区别在&#xff1a;python2.2前的版本和python2.2以后3.0以前的版本的默认情况下&#xff0c;"/"所做的除法是以一种两个数或者多个数出现一个浮点数结果就以浮点…

计算机科学概论(2)数据的操控和程序的执行

1.CPU是什么&#xff1f;它有什么作用&#xff1f;CPU(Central Processing Unit&#xff0c;中央处理器)负责操控数据在不同位置间的移动及对数据进行处理。它是计算机的核心部件。它主要由三个部分组成&#xff1a;算数/逻辑单元、控制单元、寄存器单元。算数逻辑单元负责在数…

都怪爱因斯坦没说清楚!竟有人相信一个粉笔头就能让全人类多喝100年的热水?...

全世界只有3.14 % 的人关注了爆炸吧知识一个粉笔头一共能释放多少能量爱因斯坦大家肯定都熟悉&#xff0c;相信也有很多朋友听说过质能方程。根据质能方程的公式&#xff0c;我们发现&#xff1a;似乎能量和质量是可以相互转化的。尤其是一些没有系统学习过相对论&#xff0c;又…

linux环境下用TcpDump抓包分析总结

1、手机IP 怎么知道手机ip,输入下面命令 adb shellifconfig 比如得到手机ip 2.0.0.1 2、目标IP 比如目标地址ip为10.0.0.1 3、抓包命令 我们不带端口命令如下 tcpdump -i any host 2.0.0.1 -nv 代码端口的命令如下(端口为50129) tcpdump -i any host 2.0.0.1 and port…

UVa 12100 - Printer Queue

刚A完图书系统那道题&#xff0c;然后看提交次数那个字典的比这道题多&#xff0c;看了看那道更新字典没有思路&#xff0c;就看了这道题&#xff0c;感觉这道题比更新字典简单多了。 #include<iostream> #include<queue> #include<map> using namespace std…

从微信云托管容器镜像的选择-alpine 说起

微信云托管 使用目前主流的容器平台Docker以及容器编排技术Kubernetes&#xff08;简称K8S&#xff09;&#xff0c;来管理你的项目。使用微信云托管需要掌握对Docker的使用&#xff0c;但你无需掌握K8S的使用方法。微信云托管将K8S的运维配置完全接手&#xff0c;你不需要关心…

H5移动开发AUI框架入门---博客园老牛大讲堂

大家都知道H5可以开发移动端的页面&#xff0c;网上提供的移动端的开发都有很多。因为我学习了AUI框架&#xff0c;所以我这里介绍一下移动端AUI框架。--博客园老牛大讲堂 一、AUI框架是什么&#xff1f;---博客园老牛大讲堂 AUI框架就是利用原生的js和css封装成的一些界面。当…

python画樱桃小丸子_每天坚持画画|简笔画练习“樱桃小丸子”

《樱桃小丸子》也是80后的经典回忆&#xff0c;特别是女生们。你们可能不知道如果按实际年龄来算小丸子今年已经52岁了(1965年5月8日出生)可想而知这部动画片的影响力有多大。【今日主题】《樱桃小丸子》樱桃子BY&#xff1a;网络&#xff0c;侵删【完成图】BY&#xff1a;纳豆…

linux操作命令等积累

1&#xff0c;启动服务&#xff1a;两种方式&#xff1a; /etc/init.d/networking start /etc/init.d/mysql start #:service mysql start service networking start(stop,restart) $:sudo service mysql start(stop,restart) 2, linux 程序安装位置&#xff1a;多数位于/v…