The second layer is the physical address of the source and destination nodes, based on a unique address hard-wired into each network device. Switches have traditionally existed on this second layer, like bridges before them. The first traffic control box, the bridge, kept a table of local physical addresses. When a packet appeared that didn't match the local table, it was forwarded to the other side. Switches work much the same way, with larger tables tracking multiple nodes, so the packet is sent to the correct network.
Speed is the great advantage of switches.
The physical addresses are at a fixed position in the packets, so the switch has to read very little of the packet to know where to send it. Special switching processors handle decisions within the processor itself, rather than software. Routers are special-purpose computers using software to read the third layer of the packet, the protocol address. Tracking all possible paths between the source and destination, and acting on other instructions, such as line costs and link congestion, adds delay time for processing. Routers do well to handle 200,000 packets per second.